-
Notifications
You must be signed in to change notification settings - Fork 404
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
[Macros] Introduce member declaration macros. #1207
Conversation
return DeclSyntax(expandMembers(of: node)) | ||
} | ||
|
||
override func visit(_ node: ProtocolDeclSyntax) -> DeclSyntax { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about enums? And... should this use DeclGroupSyntax
?
} | ||
|
||
do { | ||
try newMembers.append(contentsOf: memberMacro.expansion(of: customAttribute, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This worked out really nicely.
@swift-ci please test |
2d694f9
to
19700f0
Compare
@swift-ci please test |
19700f0
to
39e8e62
Compare
@swift-ci please test |
@swift-ci please test |
An initial implementation for member declaration macros.
Member declaration macros are represented as custom attributes, and expanding a member macro for a given declaration can produce a set of new members to add to that declaration. For example:
Expanding
@addBackingStorage
addsvar _storage
toS
: