Implement visitor pattern for SyntaxTree::Node #28
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What, why?
This pattern will expand our horizons and allow us to do fun stuff with the nodes through the
SyntaxTree::Visitor
class. Right now we are using metaprogramming to create and#send
to call our#visit_
methods the LSP. Ideally this would be a built in feature insyntax_tree
so others can use it as well.We've chosen to require the
Visitor
class innode.rb
to make it clearer that the file requires it. Otherwise, we'd have to add it tolib/syntax_tree.rb
in an order-dependent way, which we decided was less desirable.Who
Co-authored-by: Kaan Ozkan [email protected]
Co-authored-by: Alexandre Terrasa [email protected]
Co-authored-by: Vinicius Stock [email protected]
Co-authored-by: Emily Giurleo [email protected]
Co-authored-by: Rafael Franca [email protected]