Index: pkg/analyzer/test/generated/parser_test.dart |
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart |
index 98e80de36f5522bf50147d2a8d31bbfa39935ccf..3f8a6616650a638b3142dffe6962480b14273eda 100644 |
--- a/pkg/analyzer/test/generated/parser_test.dart |
+++ b/pkg/analyzer/test/generated/parser_test.dart |
@@ -3221,6 +3221,17 @@ class B = Object with A {}''', |
expect(expression.thenExpression.isSynthetic, isTrue); |
} |
+ void test_declarationBeforeDirective() { |
+ CompilationUnit unit = ParserTestCase.parseCompilationUnit( |
+ "class foo { } import 'bar.dart';", |
+ [ParserErrorCode.DIRECTIVE_AFTER_DECLARATION]); |
+ expect(unit.directives, hasLength(1)); |
+ expect(unit.declarations, hasLength(1)); |
+ ClassDeclaration classDecl = unit.childEntities.first; |
+ expect(classDecl, isNotNull); |
+ expect(classDecl.name.name, 'foo'); |
+ } |
+ |
void test_equalityExpression_missing_LHS() { |
BinaryExpression expression = |
parseExpression("== y", [ParserErrorCode.MISSING_IDENTIFIER]); |
@@ -3338,17 +3349,6 @@ class B = Object with A {}''', |
parseExpression("m(f() => 0);", [ParserErrorCode.EXPECTED_TOKEN]); |
} |
- void test_declarationBeforeDirective() { |
- CompilationUnit unit = ParserTestCase.parseCompilationUnit( |
- "class foo { } import 'bar.dart';", |
- [ParserErrorCode.DIRECTIVE_AFTER_DECLARATION]); |
- expect(unit.directives, hasLength(1)); |
- expect(unit.declarations, hasLength(1)); |
- ClassDeclaration classDecl = unit.childEntities.first; |
- expect(classDecl, isNotNull); |
- expect(classDecl.name.name, 'foo'); |
- } |
- |
void test_importDirectivePartial_as() { |
CompilationUnit unit = ParserTestCase.parseCompilationUnit( |
"import 'b.dart' d as b;", [ParserErrorCode.UNEXPECTED_TOKEN]); |
@@ -3549,6 +3549,41 @@ class C { |
expect(field.name.isSynthetic, isTrue); |
} |
+ void test_incompleteLocalVariable_atTheEndOfBlock() { |
+ Statement statement = ParserTestCase.parseStatement( |
+ 'String v }', [ParserErrorCode.EXPECTED_TOKEN]); |
+ expect(statement, new isInstanceOf<VariableDeclarationStatement>()); |
+ expect(statement.toSource(), 'String v;'); |
+ } |
+ |
+ void test_incompleteLocalVariable_beforeIdentifier() { |
+ Statement statement = ParserTestCase.parseStatement( |
+ 'String v String v2;', [ParserErrorCode.EXPECTED_TOKEN]); |
+ expect(statement, new isInstanceOf<VariableDeclarationStatement>()); |
+ expect(statement.toSource(), 'String v;'); |
+ } |
+ |
+ void test_incompleteLocalVariable_beforeKeyword() { |
+ Statement statement = ParserTestCase.parseStatement( |
+ 'String v if (true) {}', [ParserErrorCode.EXPECTED_TOKEN]); |
+ expect(statement, new isInstanceOf<VariableDeclarationStatement>()); |
+ expect(statement.toSource(), 'String v;'); |
+ } |
+ |
+ void test_incompleteLocalVariable_beforeNextBlock() { |
+ Statement statement = ParserTestCase.parseStatement( |
+ 'String v {}', [ParserErrorCode.EXPECTED_TOKEN]); |
+ expect(statement, new isInstanceOf<VariableDeclarationStatement>()); |
+ expect(statement.toSource(), 'String v;'); |
+ } |
+ |
+ void test_incompleteLocalVariable_parameterizedType() { |
+ Statement statement = ParserTestCase.parseStatement( |
+ 'List<String> v {}', [ParserErrorCode.EXPECTED_TOKEN]); |
+ expect(statement, new isInstanceOf<VariableDeclarationStatement>()); |
+ expect(statement.toSource(), 'List<String> v;'); |
+ } |
+ |
void test_invalidFunctionBodyModifier() { |
ParserTestCase.parseCompilationUnit( |
"f() sync {}", [ParserErrorCode.MISSING_STAR_AFTER_SYNC]); |
@@ -9423,7 +9458,7 @@ void'''); |
expect(identifier.name, lexeme); |
} |
- void test_parseStatement_emptyTypeArgumentListt() { |
+ void test_parseStatement_emptyTypeArgumentList() { |
VariableDeclarationStatement statement = parse4( |
"parseStatement", "C<> c;", [ParserErrorCode.EXPECTED_TYPE_NAME]); |
VariableDeclarationList variables = statement.variables; |