Update Dart.g to support extension types, not inline classes
Change-Id: I785eae3d32363db95a3cad00ee3c2c827a5ec9da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319400
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
diff --git a/tools/spec_parser/Dart.g b/tools/spec_parser/Dart.g
index 594dae4..9e40f0a 100644
--- a/tools/spec_parser/Dart.g
+++ b/tools/spec_parser/Dart.g
@@ -4,6 +4,9 @@
// CHANGES:
//
+// v0.36 Update syntax from `inline class` to `extension type`, including
+// a special case of primary constructors.
+//
// v0.35 Change named optional parameter syntax to require '=', that is,
// remove the support for ':' as in `void f({int i: 1})`.
//
@@ -249,7 +252,7 @@
topLevelDefinition
: classDeclaration
| mixinDeclaration
- | inlineClassDeclaration
+ | extensionTypeDeclaration
| extensionDeclaration
| enumType
| typeAlias
@@ -437,13 +440,20 @@
: classMemberDeclaration
;
-inlineClassDeclaration
- : FINAL? INLINE CLASS typeWithParameters interfaces?
- LBRACE (metadata inlineMemberDeclaration)* RBRACE
+extensionTypeDeclaration
+ : EXTENSION TYPE CONST? typeWithParameters
+ representationDeclaration
+ interfaces?
+ LBRACE (metadata extensionTypeMemberDeclaration)* RBRACE
;
+representationDeclaration
+ : ('.' identifierOrNew)? '(' metadata type identifier ')'
+ ;
+
+
// TODO: We might want to make this more strict.
-inlineMemberDeclaration
+extensionTypeMemberDeclaration
: classMemberDeclaration
;
@@ -1629,12 +1639,12 @@
: ASYNC
| BASE
| HIDE
- | INLINE
| OF
| ON
| SEALED
| SHOW
| SYNC
+ | TYPE
| WHEN
;
@@ -1915,10 +1925,6 @@
: 'hide'
;
-INLINE
- : 'inline'
- ;
-
OF
: 'of'
;
@@ -1939,6 +1945,10 @@
: 'sync'
;
+TYPE
+ : 'type'
+ ;
+
WHEN
: 'when'
;