Skip to content
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

Replace with calls with in-place mutation; clean up helpers. #609

Merged
merged 2 commits into from
Sep 4, 2023

Conversation

allevato
Copy link
Member

@allevato allevato commented Sep 3, 2023

Chaining the keypath-taking with(...) methods results in more "functional" looking code, but when there are multiple mutations that need to be made, I've found that it's often cleaner to just create a mutable copy of the node and mutate the properties in-place.

Also clean up some various helper extensions that were throughout the code base; some were no longer being used, others no longer held their weight, and some needed to be modernized.

Also remove some extensions no longer in use, and rewrite the
`DeclModifierListSyntax` helpers to take keywords instead of
strings.
These were only used in one place and have implementations that are
pretty specific to just the calling rule, so move them side-by-side
with that rule and make them file-private.
@allevato allevato merged commit 0ebb3c8 into swiftlang:main Sep 4, 2023
@allevato allevato deleted the unify-helpers branch September 4, 2023 01:23
allevato added a commit to allevato/swift-format that referenced this pull request Sep 14, 2023
Replace `with` calls with in-place mutation; clean up helpers.
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.

None yet

1 participant