@@ -1452,6 +1452,81 @@ library
1452
1452
''' );
1453
1453
}
1454
1454
1455
+ test_metadata_constructor_namedArgument () async {
1456
+ newFile ('$testPackageLibPath /a.dart' , r'''
1457
+ class A {
1458
+ const A({required int value});
1459
+ }
1460
+ ''' );
1461
+
1462
+ var library = await buildLibrary (r'''
1463
+ import 'a.dart';
1464
+ @A(value: 42)
1465
+ void f() {}
1466
+ ''' );
1467
+ checkElementText (library, r'''
1468
+ library
1469
+ reference: <testLibrary>
1470
+ fragments
1471
+ #F0 <testLibraryFragment>
1472
+ element: <testLibrary>
1473
+ libraryImports
1474
+ package:test/a.dart
1475
+ functions
1476
+ #F1 f (nameOffset:36) (firstTokenOffset:17) (offset:36)
1477
+ element: <testLibrary>::@function::f
1478
+ metadata
1479
+ Annotation
1480
+ atSign: @ @17
1481
+ name: SimpleIdentifier
1482
+ token: A @18
1483
+ element: package:test/a.dart::@class::A
1484
+ staticType: null
1485
+ arguments: ArgumentList
1486
+ leftParenthesis: ( @19
1487
+ arguments
1488
+ NamedExpression
1489
+ name: Label
1490
+ label: SimpleIdentifier
1491
+ token: value @20
1492
+ element: package:test/a.dart::@class::A::@constructor::new::@formalParameter::value
1493
+ staticType: null
1494
+ colon: : @25
1495
+ expression: IntegerLiteral
1496
+ literal: 42 @27
1497
+ staticType: int
1498
+ rightParenthesis: ) @29
1499
+ element2: package:test/a.dart::@class::A::@constructor::new
1500
+ functions
1501
+ f
1502
+ reference: <testLibrary>::@function::f
1503
+ firstFragment: #F1
1504
+ metadata
1505
+ Annotation
1506
+ atSign: @ @17
1507
+ name: SimpleIdentifier
1508
+ token: A @18
1509
+ element: package:test/a.dart::@class::A
1510
+ staticType: null
1511
+ arguments: ArgumentList
1512
+ leftParenthesis: ( @19
1513
+ arguments
1514
+ NamedExpression
1515
+ name: Label
1516
+ label: SimpleIdentifier
1517
+ token: value @20
1518
+ element: package:test/a.dart::@class::A::@constructor::new::@formalParameter::value
1519
+ staticType: null
1520
+ colon: : @25
1521
+ expression: IntegerLiteral
1522
+ literal: 42 @27
1523
+ staticType: int
1524
+ rightParenthesis: ) @29
1525
+ element2: package:test/a.dart::@class::A::@constructor::new
1526
+ returnType: void
1527
+ ''' );
1528
+ }
1529
+
1455
1530
test_metadata_constructorDeclaration_named () async {
1456
1531
var library = await buildLibrary (
1457
1532
'const a = null; class C { @a C.named(); }' ,
0 commit comments