-
Notifications
You must be signed in to change notification settings - Fork 3
Add support for macro conditions to named enums #247
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
Conversation
78088be
to
254ac4c
Compare
extension DeclSyntaxProtocol { | ||
|
||
// Wrap the declaration in an #if where needed | ||
func maybeWithCondition(ifConfigCondition: ExprSyntax?) -> DeclSyntaxProtocol { |
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 helper prevents some duplication
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.
Yeah this is nice, thanks
|
||
extension NamedRegistrationGroup { | ||
// Generate the enum for this group of named registrations | ||
func enumSourceCode(assemblyName: String) throws -> DeclSyntaxProtocol { |
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.
I moved this out of TypeSafetySourceFile to make this code easier to test in isolation.
254ac4c
to
406686c
Compare
406686c
to
9f5205e
Compare
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.
🎉
extension DeclSyntaxProtocol { | ||
|
||
// Wrap the declaration in an #if where needed | ||
func maybeWithCondition(ifConfigCondition: ExprSyntax?) -> DeclSyntaxProtocol { |
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.
Yeah this is nice, thanks
9f5205e
to
8536ec7
Compare
8536ec7
to
35f3e64
Compare
35f3e64
to
656fc56
Compare
#if
condition then the resolver and the enum are both wrapped in the same condition.#if
conditions, the resolver will not have a condition and the enum cases will be wrapped in#if
conditions from the individual registrations.