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 the ReplaceTrivia rewriter with direct trivia mutations. #588

Merged
merged 1 commit into from
Aug 10, 2023

Conversation

allevato
Copy link
Member

Previously, we were using a SyntaxRewriter to replace trivia on nodes. Historically, this originated from a time (I believe) when trivia wasn't directly mutable on nodes. The vast majority of these uses were replacing the extents: the leading trivia of the first token of a node or the trailing trivia of the last token. This can be done more easily now by just mutating those properties of the nodes.

Even in cases where we were doing something slightly more advanced, it's clearer to do in-place mutation and reconstruction; having this specialized rewriter no longer held its weight.

Previously, we were using a `SyntaxRewriter` to replace trivia on
nodes. Historically, this originated from a time (I believe) when
trivia wasn't directly mutable on nodes. The vast majority of these
uses were replacing the extents: the leading trivia of the first
token of a node or the trailing trivia of the last token. This can
be done more easily now by just mutating those properties of the
nodes.

Even in cases where we were doing something slightly more advanced,
it's clearer to do in-place mutation and reconstruction; having
this specialized rewriter no longer held its weight.
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