| 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 0838d363b8b971feec89e88cd2b077e581124e72..b046151e20cff5e564a8b852bb243c2d2707bbbe 100644
|
| --- a/pkg/analyzer/test/generated/parser_test.dart
|
| +++ b/pkg/analyzer/test/generated/parser_test.dart
|
| @@ -3482,9 +3482,10 @@ class Foo {
|
| }
|
|
|
| void test_nonIdentifierLibraryName_partOf() {
|
| - CompilationUnit unit = parseCompilationUnit(
|
| - "part of 3;", [ParserErrorCode.MISSING_NAME_IN_PART_OF_DIRECTIVE,
|
| - ParserErrorCode.UNEXPECTED_TOKEN]);
|
| + CompilationUnit unit = parseCompilationUnit("part of 3;", [
|
| + ParserErrorCode.MISSING_NAME_IN_PART_OF_DIRECTIVE,
|
| + ParserErrorCode.UNEXPECTED_TOKEN
|
| + ]);
|
| expect(unit, isNotNull);
|
| }
|
|
|
| @@ -13180,6 +13181,14 @@ abstract class TopLevelParserTestMixin implements AbstractParserTestCase {
|
| expect(declaration.members, hasLength(0));
|
| expect(declaration.rightBracket, isNotNull);
|
| expect(declaration.typeParameters, isNull);
|
| + _assertDeclarationName(declaration.name);
|
| + }
|
| +
|
| + /**
|
| + * Assert that the given [name] is in declaration context.
|
| + */
|
| + void _assertDeclarationName(SimpleIdentifier name) {
|
| + expect(name.inDeclarationContext(), isTrue);
|
| }
|
|
|
| void test_parseClassDeclaration_extends() {
|
| @@ -13328,6 +13337,7 @@ abstract class TopLevelParserTestMixin implements AbstractParserTestCase {
|
| expect(typeAlias.implementsClause.implementsKeyword, isNotNull);
|
| expect(typeAlias.implementsClause.interfaces.length, 1);
|
| expect(typeAlias.semicolon, isNotNull);
|
| + _assertDeclarationName(typeAlias.name);
|
| }
|
|
|
| void test_parseClassDeclaration_typeAlias_withB() {
|
| @@ -13365,6 +13375,7 @@ abstract class TopLevelParserTestMixin implements AbstractParserTestCase {
|
| expect(declaration.rightBracket, isNotNull);
|
| expect(declaration.typeParameters, isNotNull);
|
| expect(declaration.typeParameters.typeParameters, hasLength(1));
|
| + _assertDeclarationName(declaration.typeParameters.typeParameters[0].name);
|
| }
|
|
|
| void test_parseClassDeclaration_withDocumentationComment() {
|
| @@ -13550,6 +13561,7 @@ abstract class TopLevelParserTestMixin implements AbstractParserTestCase {
|
| expect(declaration.semicolon, isNotNull);
|
| expect(declaration.variables, isNotNull);
|
| expect(declaration.variables.keyword.lexeme, 'const');
|
| + _assertDeclarationName(declaration.variables.variables[0].name);
|
| }
|
|
|
| void test_parseCompilationUnitMember_expressionFunctionBody_tokens() {
|
| @@ -13558,6 +13570,7 @@ abstract class TopLevelParserTestMixin implements AbstractParserTestCase {
|
| var body = f.functionExpression.body as ExpressionFunctionBody;
|
| expect(body.functionDefinition.lexeme, '=>');
|
| expect(body.semicolon.lexeme, ';');
|
| + _assertDeclarationName(f.name);
|
| }
|
|
|
| void test_parseCompilationUnitMember_finalVariable() {
|
| @@ -13683,6 +13696,7 @@ abstract class TopLevelParserTestMixin implements AbstractParserTestCase {
|
| expect(declaration.externalKeyword, isNotNull);
|
| expect(declaration.functionExpression, isNotNull);
|
| expect(declaration.propertyKeyword, isNotNull);
|
| + _assertDeclarationName(declaration.name);
|
| }
|
|
|
| void test_parseCompilationUnitMember_getter_external_type() {
|
| @@ -13752,6 +13766,7 @@ abstract class TopLevelParserTestMixin implements AbstractParserTestCase {
|
| FunctionDeclaration declaration = member;
|
| expect(declaration.functionExpression, isNotNull);
|
| expect(declaration.propertyKeyword, isNotNull);
|
| + _assertDeclarationName(declaration.name);
|
| }
|
|
|
| void test_parseCompilationUnitMember_setter_type() {
|
| @@ -13782,6 +13797,7 @@ abstract class TopLevelParserTestMixin implements AbstractParserTestCase {
|
| expect(typeAlias.withClause, isNotNull);
|
| expect(typeAlias.implementsClause, isNull);
|
| expect(typeAlias.semicolon, isNotNull);
|
| + _assertDeclarationName(typeAlias.name);
|
| }
|
|
|
| void test_parseCompilationUnitMember_typeAlias_generic() {
|
| @@ -13847,6 +13863,7 @@ abstract class TopLevelParserTestMixin implements AbstractParserTestCase {
|
| FunctionTypeAlias typeAlias = member;
|
| expect(typeAlias.name.name, "F");
|
| expect(typeAlias.parameters.parameters, hasLength(0));
|
| + _assertDeclarationName(typeAlias.name);
|
| }
|
|
|
| void test_parseCompilationUnitMember_typedef_withDocComment() {
|
| @@ -13866,6 +13883,7 @@ abstract class TopLevelParserTestMixin implements AbstractParserTestCase {
|
| expect(declaration.variables, isNotNull);
|
| expect(declaration.variables.type, isNotNull);
|
| expect(declaration.variables.keyword, isNull);
|
| + _assertDeclarationName(declaration.variables.variables[0].name);
|
| }
|
|
|
| void test_parseCompilationUnitMember_variable() {
|
|
|