Skip to content

Commit a77efcb

Browse files
committed
Use dedicated type for union syntax
1 parent 276c9bd commit a77efcb

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

src/syntax.grammar

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,11 +1389,12 @@ NamespaceMemberDecl[group=Declaration] { NamespaceDecl | TypeDecl }
13891389
TypeDecl[group=Declaration] {
13901390
ClassDecl
13911391
| ExtensionBlockDecl
1392-
| StructDecl
13931392
| InterfaceDecl
13941393
| RecordDecl
13951394
| EnumDecl
13961395
| DelegateDecl
1396+
| StructDecl
1397+
| UnionDecl
13971398
}
13981399

13991400

@@ -1747,7 +1748,7 @@ finalizerBody {
17471748
// Struct declaration
17481749

17491750
StructDecl[group=Declaration] {
1750-
attrs? modifier* (kw<'struct'> | kw<'union'>)
1751+
attrs? modifier* kw<'struct'>
17511752
TypeIdentifier typeParamList? typeParamConstraintsClause*
17521753
formalParams? classBase?
17531754
(structBody ';'? | ';')
@@ -1768,6 +1769,14 @@ StructMemberDecl[group=Declaration] {
17681769
| FixedSizeBufferDecl
17691770
}
17701771

1772+
// Union declaration
1773+
1774+
UnionDecl[group=Declaration] {
1775+
attrs? modifier* kw<'union'>
1776+
TypeIdentifier typeParamList? typeParamConstraintsClause*
1777+
formalParams? classBase?
1778+
(classBody ';'? | ';')
1779+
}
17711780

17721781
// Array initializer
17731782

0 commit comments

Comments
 (0)