Skip to content

Commit bc30907

Browse files
eernstgCommit Queue
authored andcommitted
Add support for static access shorthands
Change-Id: I826e230ad38388a8e1f6ccc366704a2e8c340dee Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397301 Reviewed-by: Chloe Stefantsova <[email protected]> Commit-Queue: Erik Ernst <[email protected]>
1 parent 19da943 commit bc30907

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

tools/spec_parser/Dart.g

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
// CHANGES:
66
//
7+
// v0.52 Support static access shorthands.
8+
//
79
// v0.51 Support a `switchExpression` with no cases.
810
//
911
// v0.50 Add support for digit separators in numeric literals.
@@ -681,6 +683,7 @@ primary
681683
| '(' expression ')'
682684
| constructorTearoff
683685
| switchExpression
686+
| staticMemberShorthand
684687
;
685688

686689
constructorInvocation
@@ -796,6 +799,11 @@ switchExpressionCase
796799
: guardedPattern '=>' expression
797800
;
798801

802+
staticMemberShorthand
803+
: '.' identifierOrNew selector*
804+
| CONST '.' identifierOrNew selector*
805+
;
806+
799807
throwExpression
800808
: THROW expression
801809
;
@@ -1170,6 +1178,7 @@ constantPattern
11701178
| CONST typeArguments? '[' elements? ']'
11711179
| CONST typeArguments? LBRACE elements? RBRACE
11721180
| CONST '(' expression ')'
1181+
| staticMemberShorthand
11731182
;
11741183

11751184
variablePattern

tools/spec_parser/dart_spec_parser/Dart.g4

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
// CHANGES:
66
//
7+
// v0.53 Support static access shorthands.
8+
//
79
// v0.52 Support a `switchExpression` with no cases.
810
//
911
// v0.51 Add support for digit separators in numeric literals.
@@ -687,6 +689,7 @@ primary
687689
| '(' expression ')'
688690
| constructorTearoff
689691
| switchExpression
692+
| staticMemberShorthand
690693
;
691694

692695
constructorInvocation
@@ -802,6 +805,11 @@ switchExpressionCase
802805
: guardedPattern '=>' expression
803806
;
804807

808+
staticMemberShorthand
809+
: '.' identifierOrNew selector*
810+
| CONST '.' identifierOrNew selector*
811+
;
812+
805813
throwExpression
806814
: THROW expression
807815
;
@@ -1176,6 +1184,7 @@ constantPattern
11761184
| CONST typeArguments? '[' elements? ']'
11771185
| CONST typeArguments? LBRACE elements? RBRACE
11781186
| CONST '(' expression ')'
1187+
| staticMemberShorthand
11791188
;
11801189

11811190
variablePattern

0 commit comments

Comments
 (0)