@@ -13315,6 +13315,56 @@ abstract class TopLevelParserTestMixin implements AbstractParserTestCase {
13315
13315
expect(declaration.typeParameters, isNull);
13316
13316
}
13317
13317
13318
+ void test_parseClassDeclaration_metadata() {
13319
+ createParser('@A @B(2) @C.foo(3) @d.E.bar(4, 5) class X {}');
13320
+ var declaration = parseFullCompilationUnitMember() as ClassDeclaration;
13321
+ expect(declaration.metadata, hasLength(4));
13322
+
13323
+ {
13324
+ var annotation = declaration.metadata[0];
13325
+ expect(annotation.atSign, isNotNull);
13326
+ expect(annotation.name, new isInstanceOf<SimpleIdentifier>());
13327
+ expect(annotation.name.name, 'A');
13328
+ expect(annotation.period, isNull);
13329
+ expect(annotation.constructorName, isNull);
13330
+ expect(annotation.arguments, isNull);
13331
+ }
13332
+
13333
+ {
13334
+ var annotation = declaration.metadata[1];
13335
+ expect(annotation.atSign, isNotNull);
13336
+ expect(annotation.name, new isInstanceOf<SimpleIdentifier>());
13337
+ expect(annotation.name.name, 'B');
13338
+ expect(annotation.period, isNull);
13339
+ expect(annotation.constructorName, isNull);
13340
+ expect(annotation.arguments, isNotNull);
13341
+ expect(annotation.arguments.arguments, hasLength(1));
13342
+ }
13343
+
13344
+ {
13345
+ var annotation = declaration.metadata[2];
13346
+ expect(annotation.atSign, isNotNull);
13347
+ expect(annotation.name, new isInstanceOf<PrefixedIdentifier>());
13348
+ expect(annotation.name.name, 'C.foo');
13349
+ expect(annotation.period, isNull);
13350
+ expect(annotation.constructorName, isNull);
13351
+ expect(annotation.arguments, isNotNull);
13352
+ expect(annotation.arguments.arguments, hasLength(1));
13353
+ }
13354
+
13355
+ {
13356
+ var annotation = declaration.metadata[3];
13357
+ expect(annotation.atSign, isNotNull);
13358
+ expect(annotation.name, new isInstanceOf<PrefixedIdentifier>());
13359
+ expect(annotation.name.name, 'd.E');
13360
+ expect(annotation.period, isNotNull);
13361
+ expect(annotation.constructorName, isNotNull);
13362
+ expect(annotation.constructorName.name, 'bar');
13363
+ expect(annotation.arguments, isNotNull);
13364
+ expect(annotation.arguments.arguments, hasLength(2));
13365
+ }
13366
+ }
13367
+
13318
13368
void test_parseClassDeclaration_native() {
13319
13369
createParser('class A native "nativeValue" {}');
13320
13370
CompilationUnitMember member = parseFullCompilationUnitMember();
0 commit comments