Skip to content

Commit

Permalink
Address CR feedback
Browse files Browse the repository at this point in the history
UIP-1638
  • Loading branch information
jacehensley-wf committed Jun 20, 2017
1 parent 7fabecc commit 9966046
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
8 changes: 7 additions & 1 deletion lib/src/transformer/impl_generation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,13 @@ class ImplGenerator {
);
}

if (new RegExp(r'typed(Props|State)Factory\(.+\)(\s+)?({|=>)').hasMatch(sourceFile.getText(0))) {
var implementsTypedPropsStateFactory = declarations.component.node.members.any((member) =>
member is MethodDeclaration &&
!member.isStatic &&
(member.name.name == 'typedPropsFactory' || member.name.name == 'typedStateFactory')
);

if (implementsTypedPropsStateFactory) {
// Can't be an error, because consumers may be implementing typedPropsFactory or typedStateFactory in their components.
logger.warning(
'Components should not add their own implementions of typedPropsFactory or typedStateFactory.',
Expand Down
1 change: 0 additions & 1 deletion test/integration/strong_mode_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ main() {
test('generates strong mode compliant code', () async {
var testProject = copyProject(strongModeProject);

// Run `pub get` and the bootstrap up-front so that back-to-back runs on the same directory complete faster.
new File('$testProject/pubspec.yaml').writeAsStringSync(getPubspec());

expect(await Process.run('pub', ['get'], workingDirectory: testProject), succeeded);
Expand Down
9 changes: 6 additions & 3 deletions test_fixtures/strong_mode/web/generic_component.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import 'package:over_react/over_react.dart';

@Factory()
UiFactory<GenericStatelessProps> GenericStateless;
UiFactory<GenericStatefulProps> GenericStateful;

@Props()
class GenericStatelessProps extends UiProps {}
class GenericStatefulProps extends UiProps {}

@State()
class GenericStatefulState extends UiState {}

@Component()
class GenericStatelessComponent<T extends GenericStatelessProps> extends UiComponent<T> {
class GenericStatefulComponent<T extends GenericStatefulProps, S extends GenericStatefulState> extends UiStatefulComponent<T, S> {
@override
render() { }
}

0 comments on commit 9966046

Please sign in to comment.