-
Notifications
You must be signed in to change notification settings - Fork 471
Refactor generation of SwiftSyntaxBuilder #350
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
Refactor generation of SwiftSyntaxBuilder #350
Conversation
|
@kimdv Please let me know what you think about this refactoring. |
|
@swift-ci Please test |
kimdv
left a comment
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.
Wow! 🎉
This is pretty good. Really nice job! 🥳
It was needed!
Just some inline comments/questions 😁
Sources/SwiftSyntaxBuilder/gyb_helpers/SyntaxBuildableWrappers.py
Outdated
Show resolved
Hide resolved
Sources/SwiftSyntaxBuilder/gyb_helpers/SyntaxBuildableWrappers.py
Outdated
Show resolved
Hide resolved
24392b4 to
faa6b1e
Compare
|
@swift-ci Please test |
Perform a complete refactoring of the way the `SwiftSyntaxBuilder` files are generated with the following goals: - Move complex Python logic from the `.gyb` files into proper Python files that are being imported to make the `.gyb` files more readable - Unify the location that the different `Buildable`, `ExpressibleAs` etc. types are being generated to reduce the likelihood of making a mistake when generating these types in the `.gyb` files - Reduce the number of extensions being used. All methods of structs should be implemented in the struct itself and all protocols should have a single extension directly underneath it that provides all default conformances. Previously, I was always scanning through the entire code base to find the location one particular method was implement. I think this also makes the result builder methods more discoverable since they are no longer hidden in an extension. - Reduce the dependency on `gyb_syntax_support` by moving `protocolMap.py` to this repository. The actual generated source code stays mostly the same, it is just ordered differently and split into multiple files.
faa6b1e to
bcb9919
Compare
|
@swift-ci Please test |
kimdv
left a comment
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 have no further comments!
Really good and impressive work. Nice job 🥳
|
Thank you for the good review, Kim. |
Perform a complete refactoring of the way the
SwiftSyntaxBuilderfiles are generated with the following goals:.gybfiles into proper Python files that are being imported to make the.gybfiles more readableBuildable,ExpressibleAsetc. types are being generated to reduce the likelihood of making a mistake when generating these types in the.gybfilesgyb_syntax_supportby movingprotocolMap.pyto this repository.The actual generated source code stays mostly the same, it is just ordered differently and split into multiple files.