Chromium Code Reviews| 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 8a58874c299d1de70cc5f94498c54de8cb85ab71..e9953a0dead506bff41b55ab78dc5a20eff5ea14 100644 |
| --- a/pkg/analyzer/test/generated/parser_test.dart |
| +++ b/pkg/analyzer/test/generated/parser_test.dart |
| @@ -3710,6 +3710,36 @@ class C { |
| expect(statement.toSource(), 'List<String> v;'); |
| } |
| + void test_incompleteParameterizedType_field() { |
|
Brian Wilkerson
2016/01/21 19:25:12
The method _expectGT is also used for type paramet
scheglov
2016/01/21 21:03:47
Done.
|
| + CompilationUnit unit = ParserTestCase.parseCompilationUnit( |
| + r''' |
| +class C { |
| + final List<int f; |
| +}''', |
| + [ParserErrorCode.EXPECTED_TOKEN]); |
| + // one class |
| + List<CompilationUnitMember> declarations = unit.declarations; |
| + expect(declarations, hasLength(1)); |
| + ClassDeclaration classDecl = declarations[0] as ClassDeclaration; |
| + // one field declaration |
| + List<ClassMember> members = classDecl.members; |
| + expect(members, hasLength(1)); |
| + FieldDeclaration fieldDecl = members[0] as FieldDeclaration; |
| + // one field |
| + VariableDeclarationList fieldList = fieldDecl.fields; |
| + List<VariableDeclaration> fields = fieldList.variables; |
| + expect(fields, hasLength(1)); |
| + VariableDeclaration field = fields[0]; |
| + expect(field.name.name, 'f'); |
| + // validate the type |
| + TypeArgumentList typeArguments = fieldList.type.typeArguments; |
| + expect(typeArguments.arguments, hasLength(1)); |
| + // synthetic '>' |
| + Token token = typeArguments.endToken; |
| + expect(token.type, TokenType.GT); |
| + expect(token.isSynthetic, isTrue); |
| + } |
| + |
| void test_invalidFunctionBodyModifier() { |
| ParserTestCase.parseCompilationUnit( |
| "f() sync {}", [ParserErrorCode.MISSING_STAR_AFTER_SYNC]); |