@@ -1283,6 +1283,10 @@ abstract class AstVisitor<R> {
1283
1283
1284
1284
R? visitDoStatement(DoStatement node);
1285
1285
1286
+ R? visitDotShorthandInvocation(DotShorthandInvocation node);
1287
+
1288
+ R? visitDotShorthandPropertyAccess(DotShorthandPropertyAccess node);
1289
+
1286
1290
R? visitDottedName(DottedName node);
1287
1291
1288
1292
R? visitDoubleLiteral(DoubleLiteral node);
@@ -5392,6 +5396,140 @@ final class DoStatementImpl extends StatementImpl implements DoStatement {
5392
5396
}
5393
5397
}
5394
5398
5399
+ /// A node that represents a dot shorthand static method or constructor
5400
+ /// invocation.
5401
+ ///
5402
+ /// For example, `.parse('42')`.
5403
+ ///
5404
+ /// dotShorthandHead ::=
5405
+ /// '.' [SimpleIdentifier] [TypeArgumentList]? [ArgumentList]
5406
+ @experimental
5407
+ @AnalyzerPublicApi(message: 'exported by lib/dart/ast/ast.dart')
5408
+ abstract final class DotShorthandInvocation extends InvocationExpression {
5409
+ /// The name of the constructor or static method invocation.
5410
+ SimpleIdentifier get memberName;
5411
+
5412
+ /// The token representing the period.
5413
+ Token get period;
5414
+ }
5415
+
5416
+ final class DotShorthandInvocationImpl extends InvocationExpressionImpl
5417
+ implements DotShorthandInvocation {
5418
+ @override
5419
+ final Token period;
5420
+
5421
+ SimpleIdentifierImpl _memberName;
5422
+
5423
+ /// Initializes a newly created dot shorthand invocation.
5424
+ DotShorthandInvocationImpl({
5425
+ required this.period,
5426
+ required SimpleIdentifierImpl memberName,
5427
+ required super.typeArguments,
5428
+ required super.argumentList,
5429
+ }) : _memberName = memberName {
5430
+ _becomeParentOf(_memberName);
5431
+ }
5432
+
5433
+ @override
5434
+ Token get beginToken => period;
5435
+
5436
+ @override
5437
+ Token get endToken => argumentList.endToken;
5438
+
5439
+ @override
5440
+ ExpressionImpl get function => memberName;
5441
+
5442
+ @override
5443
+ SimpleIdentifierImpl get memberName => _memberName;
5444
+
5445
+ set memberName(SimpleIdentifierImpl identifier) {
5446
+ _memberName = _becomeParentOf(identifier);
5447
+ }
5448
+
5449
+ @override
5450
+ Precedence get precedence => Precedence.postfix;
5451
+
5452
+ @override
5453
+ ChildEntities get _childEntities => ChildEntities()
5454
+ ..addToken('period', period)
5455
+ ..addNode('memberName', memberName)
5456
+ ..addNode('typeArguments', typeArguments)
5457
+ ..addNode('argumentList', argumentList);
5458
+
5459
+ @override
5460
+ E? accept<E>(AstVisitor<E> visitor) =>
5461
+ visitor.visitDotShorthandInvocation(this);
5462
+
5463
+ @override
5464
+ void resolveExpression(ResolverVisitor resolver, TypeImpl contextType) {
5465
+ resolver.visitDotShorthandInvocation(this, contextType: contextType);
5466
+ }
5467
+
5468
+ @override
5469
+ void visitChildren(AstVisitor visitor) {
5470
+ memberName.accept(visitor);
5471
+ typeArguments?.accept(visitor);
5472
+ argumentList.accept(visitor);
5473
+ }
5474
+ }
5475
+
5476
+ /// A node that represents a dot shorthand property access of a field or a
5477
+ /// static getter.
5478
+ ///
5479
+ /// For example, `.zero`.
5480
+ ///
5481
+ /// dotShorthandHead ::= '.' [SimpleIdentifier]
5482
+ @experimental
5483
+ @AnalyzerPublicApi(message: 'exported by lib/dart/ast/ast.dart')
5484
+ abstract final class DotShorthandPropertyAccess extends Expression {
5485
+ /// The token representing the period.
5486
+ Token get period;
5487
+
5488
+ /// The name of the property being accessed.
5489
+ Token get propertyName;
5490
+ }
5491
+
5492
+ final class DotShorthandPropertyAccessImpl extends ExpressionImpl
5493
+ implements DotShorthandPropertyAccess {
5494
+ @override
5495
+ final Token period;
5496
+
5497
+ @override
5498
+ final Token propertyName;
5499
+
5500
+ /// Initializes a newly created dot shorthand property access.
5501
+ DotShorthandPropertyAccessImpl({
5502
+ required this.period,
5503
+ required this.propertyName,
5504
+ });
5505
+
5506
+ @override
5507
+ Token get beginToken => period;
5508
+
5509
+ @override
5510
+ Token get endToken => propertyName;
5511
+
5512
+ @override
5513
+ Precedence get precedence => Precedence.postfix;
5514
+
5515
+ @override
5516
+ ChildEntities get _childEntities => ChildEntities()
5517
+ ..addToken('period', period)
5518
+ ..addToken('propertyName', propertyName);
5519
+
5520
+ @override
5521
+ E? accept<E>(AstVisitor<E> visitor) =>
5522
+ visitor.visitDotShorthandPropertyAccess(this);
5523
+
5524
+ @override
5525
+ void resolveExpression(ResolverVisitor resolver, TypeImpl contextType) {
5526
+ resolver.visitDotShorthandPropertyAccess(this, contextType: contextType);
5527
+ }
5528
+
5529
+ @override
5530
+ void visitChildren(AstVisitor visitor) {}
5531
+ }
5532
+
5395
5533
/// A dotted name, used in a configuration within an import or export directive.
5396
5534
///
5397
5535
/// dottedName ::=
@@ -10838,8 +10976,8 @@ final class InterpolationStringImpl extends InterpolationElementImpl
10838
10976
10839
10977
/// The invocation of a function or method.
10840
10978
///
10841
- /// This will either be a [FunctionExpressionInvocation] or a
10842
- /// [MethodInvocation ].
10979
+ /// This will either be a [FunctionExpressionInvocation], [MethodInvocation],
10980
+ /// or a [DotShorthandInvocation ].
10843
10981
@AnalyzerPublicApi(message: 'exported by lib/dart/ast/ast.dart')
10844
10982
abstract final class InvocationExpression implements Expression {
10845
10983
/// The list of arguments to the method.
0 commit comments