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 1b6d7d87fc4ef7830cce1239fd2ad23b9951d9c0..fdf3a50ed6ac7c3776b4be251eac46a952ef73e9 100644 |
--- a/pkg/analyzer/test/generated/parser_test.dart |
+++ b/pkg/analyzer/test/generated/parser_test.dart |
@@ -2471,6 +2471,17 @@ class B = Object with A {}''', [ParserErrorCode.EXPECTED_TOKEN]); |
expect(vars[0].name.name, "v"); |
} |
+ void test_functionExpression_named() { |
+ ParserTestCase.parseExpression("m(f() => 0);", [ |
+ ParserErrorCode.EXPECTED_TOKEN]); |
+ } |
+ |
+ void test_incomplete_conditionalExpression() { |
+ ParserTestCase.parseExpression("x ? 0", [ |
+ ParserErrorCode.EXPECTED_TOKEN, |
+ ParserErrorCode.MISSING_IDENTIFIER]); |
+ } |
+ |
void test_incomplete_constructorInitializers_empty() { |
ParserTestCase.parse3( |
"parseClassMember", |
@@ -2503,6 +2514,11 @@ class B = Object with A {}''', [ParserErrorCode.EXPECTED_TOKEN]); |
[ParserErrorCode.MISSING_ASSIGNMENT_IN_INITIALIZER]); |
} |
+ void test_incomplete_topLevelFunction() { |
+ ParserTestCase.parseCompilationUnit("foo();", [ |
+ ParserErrorCode.MISSING_FUNCTION_BODY]); |
+ } |
+ |
void test_incomplete_topLevelVariable() { |
CompilationUnit unit = ParserTestCase.parseCompilationUnit("String", [ParserErrorCode.EXPECTED_EXECUTABLE]); |
NodeList<CompilationUnitMember> declarations = unit.declarations; |
@@ -2626,6 +2642,11 @@ class C { |
expect(field.name.isSynthetic, isTrue); |
} |
+ void test_invalidFunctionBodyModifier() { |
+ ParserTestCase.parseCompilationUnit("f() sync {}", [ |
+ ParserErrorCode.MISSING_STAR_AFTER_SYNC]); |
+ } |
+ |
void test_isExpression_noType() { |
CompilationUnit unit = ParserTestCase.parseCompilationUnit("class Bar<T extends Foo> {m(x){if (x is ) return;if (x is !)}}", [ |
ParserErrorCode.EXPECTED_TYPE_NAME, |
@@ -2645,6 +2666,13 @@ class C { |
EngineTestCase.assertInstanceOf((obj) => obj is EmptyStatement, EmptyStatement, ifStatement.thenStatement); |
} |
+ void test_keywordInPlaceOfIdentifier() { |
+ // TODO(brianwilkerson) We could do better with this. |
+ ParserTestCase.parseCompilationUnit("do() {}", [ |
+ ParserErrorCode.EXPECTED_EXECUTABLE, |
+ ParserErrorCode.UNEXPECTED_TOKEN]); |
+ } |
+ |
void test_logicalAndExpression_missing_LHS() { |
BinaryExpression expression = ParserTestCase.parseExpression("&& y", [ParserErrorCode.MISSING_IDENTIFIER]); |
EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, SimpleIdentifier, expression.leftOperand); |
@@ -2721,6 +2749,11 @@ class C { |
EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, BinaryExpression, expression.rightOperand); |
} |
+ void test_missing_commaInArgumentList() { |
+ ParserTestCase.parseExpression("f(x: 1 y: 2)", [ |
+ ParserErrorCode.EXPECTED_TOKEN]); |
+ } |
+ |
void test_missingGet() { |
CompilationUnit unit = ParserTestCase.parseCompilationUnit(r''' |
class C { |
@@ -2893,6 +2926,11 @@ class C { |
CompilationUnitMember member = declarations[0]; |
EngineTestCase.assertInstanceOf((obj) => obj is FunctionTypeAlias, FunctionTypeAlias, member); |
} |
+ |
+ void test_unaryPlus() { |
+ ParserTestCase.parseExpression("+2", [ |
+ ParserErrorCode.MISSING_IDENTIFIER]); |
+ } |
} |
class ResolutionCopierTest extends EngineTestCase { |
@@ -8338,4 +8376,4 @@ main() { |
runReflectiveTests(RecoveryParserTest); |
runReflectiveTests(ResolutionCopierTest); |
runReflectiveTests(SimpleParserTest); |
-} |
+} |