Skip to content

MissingDeclSyntax Can Have Attributes and Modifiers #60513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 12, 2022

Conversation

CodaFi
Copy link
Contributor

@CodaFi CodaFi commented Aug 11, 2022

Strange as it sounds, we parse

@foo public

in item position as a decl that has a hanging attribute and access
control modifier. We need to be able to stick... something in the
tree here so we don't just drop these tokens on the floor.

Strange as it sounds, we parse

@foo public

in item position as a decl that has a hanging attribute and access
control modifier. We need to be able to stick... something in the
tree here so we don't just drop these tokens on the floor.
@CodaFi CodaFi requested a review from ahoppen August 11, 2022 18:07
@CodaFi
Copy link
Contributor Author

CodaFi commented Aug 11, 2022

swiftlang/swift-syntax#578

@swift-ci smoke test

Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder whether a better design would be to have a

    Node('AttributedDecl', kind='Decl', children=[
         Child('Attributes', kind='AttributeList',
               collection_element_name='Attribute', is_optional=True),
         Child('Modifiers', kind='ModifierList',
               collection_element_name='Modifier', is_optional=True),
         Child('Decl', kind='Decl'),
     ]),

remove Attributes and Modifiers from the existing Decl types and then just use an AttributedDecl with a MissingDecl as the Decl child.

@CodaFi CodaFi merged commit 72cef81 into swiftlang:main Aug 12, 2022
@CodaFi CodaFi deleted the running-on-empty branch August 12, 2022 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants