Skip to content

Commit 9b17cc4

Browse files
committed
[Syntax] Split ActorDecl into its own syntax node apart from ClassDecl.
1 parent 4aad8a9 commit 9b17cc4

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

utils/gyb_syntax_support/DeclNodes.py

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@
197197
]),
198198

199199
# class-declaration -> attributes? access-level-modifier?
200-
# ('class' | 'actor') class-name
200+
# 'class' class-name
201201
# generic-parameter-clause?
202202
# type-inheritance-clause?
203203
# generic-where-clause?
@@ -210,8 +210,7 @@
210210
collection_element_name='Attribute', is_optional=True),
211211
Child('Modifiers', kind='ModifierList',
212212
collection_element_name='Modifier', is_optional=True),
213-
Child('ClassOrActorKeyword', kind='Token',
214-
token_choices=['ClassToken', 'ContextualKeywordToken']),
213+
Child('ClassKeyword', kind='ClassToken'),
215214
Child('Identifier', kind='IdentifierToken'),
216215
Child('GenericParameterClause', kind='GenericParameterClause',
217216
is_optional=True),
@@ -222,6 +221,31 @@
222221
Child('Members', kind='MemberDeclBlock'),
223222
]),
224223

224+
# actor-declaration -> attributes? access-level-modifier?
225+
# 'actor' actor-name
226+
# generic-parameter-clause?
227+
# type-inheritance-clause?
228+
# generic-where-clause?
229+
# '{' actor-members '}'
230+
# actor-name -> identifier
231+
Node('ActorDecl', kind='Decl',
232+
traits=['DeclGroup', 'IdentifiedDecl'],
233+
children=[
234+
Child('Attributes', kind='AttributeList',
235+
collection_element_name='Attribute', is_optional=True),
236+
Child('Modifiers', kind='ModifierList',
237+
collection_element_name='Modifier', is_optional=True),
238+
Child('ActorKeyword', kind='ContextualKeywordToken',
239+
text_choices=['actor']),
240+
Child('Identifier', kind='IdentifierToken'),
241+
Child('GenericParameterClause', kind='GenericParameterClause',
242+
is_optional=True),
243+
Child('InheritanceClause', kind='TypeInheritanceClause',
244+
is_optional=True),
245+
Child('GenericWhereClause', kind='GenericWhereClause',
246+
is_optional=True),
247+
Child('Members', kind='MemberDeclBlock'),
248+
]),
225249
# struct-declaration -> attributes? access-level-modifier?
226250
# 'struct' struct-name
227251
# generic-parameter-clause?

utils/gyb_syntax_support/NodeSerializationCodes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
'CodeBlock': 93,
9999
'DeclNameArgument': 94,
100100
'DeclNameArguments': 95,
101-
# removed: 'FunctionCallArgument': 96,
101+
'ActorDecl': 96,
102102
'TupleExprElement': 97,
103103
'ArrayElement': 98,
104104
'DictionaryElement': 99,

0 commit comments

Comments
 (0)