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 bdc478523abe6f536dcb093a6f856a4307fd6eb8..68fc5a672a8f88892e3c17b3ec56df29c4f944cc 100644 |
--- a/pkg/analyzer/test/generated/parser_test.dart |
+++ b/pkg/analyzer/test/generated/parser_test.dart |
@@ -13412,6 +13412,56 @@ abstract class TopLevelParserTestMixin implements AbstractParserTestCase { |
expectCommentText(classDeclaration.documentationComment, '/// Doc'); |
} |
+ void test_parseClassDeclaration_metadata() { |
+ createParser('@A @B(2) @C.foo(3) @d.E.bar(4, 5) class X {}'); |
+ var declaration = parseFullCompilationUnitMember() as ClassDeclaration; |
+ expect(declaration.metadata, hasLength(4)); |
+ |
+ { |
+ var annotation = declaration.metadata[0]; |
+ expect(annotation.atSign, isNotNull); |
+ expect(annotation.name, new isInstanceOf<SimpleIdentifier>()); |
+ expect(annotation.name.name, 'A'); |
+ expect(annotation.period, isNull); |
+ expect(annotation.constructorName, isNull); |
+ expect(annotation.arguments, isNull); |
+ } |
+ |
+ { |
+ var annotation = declaration.metadata[1]; |
+ expect(annotation.atSign, isNotNull); |
+ expect(annotation.name, new isInstanceOf<SimpleIdentifier>()); |
+ expect(annotation.name.name, 'B'); |
+ expect(annotation.period, isNull); |
+ expect(annotation.constructorName, isNull); |
+ expect(annotation.arguments, isNotNull); |
+ expect(annotation.arguments.arguments, hasLength(1)); |
+ } |
+ |
+ { |
+ var annotation = declaration.metadata[2]; |
+ expect(annotation.atSign, isNotNull); |
+ expect(annotation.name, new isInstanceOf<PrefixedIdentifier>()); |
+ expect(annotation.name.name, 'C.foo'); |
+ expect(annotation.period, isNull); |
+ expect(annotation.constructorName, isNull); |
+ expect(annotation.arguments, isNotNull); |
+ expect(annotation.arguments.arguments, hasLength(1)); |
+ } |
+ |
+ { |
+ var annotation = declaration.metadata[3]; |
+ expect(annotation.atSign, isNotNull); |
+ expect(annotation.name, new isInstanceOf<PrefixedIdentifier>()); |
+ expect(annotation.name.name, 'd.E'); |
+ expect(annotation.period, isNotNull); |
+ expect(annotation.constructorName, isNotNull); |
+ expect(annotation.constructorName.name, 'bar'); |
+ expect(annotation.arguments, isNotNull); |
+ expect(annotation.arguments.arguments, hasLength(2)); |
+ } |
+ } |
+ |
void test_parseClassTypeAlias_withDocumentationComment() { |
createParser('/// Doc\nclass C = D with E;'); |
var classTypeAlias = parseFullCompilationUnitMember() as ClassTypeAlias; |