-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
Combine Elsif
node with IfNode
#299
Conversation
312d110
to
22d2648
Compare
2a1a922
to
37c0a4d
Compare
Hey @kddnewton just gently bumping this. I'd love a review when you have time! |
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.
Just a couple of changes, thanks so much for this work!
Many other Ruby ASTs do not have a separate node representing `elsif` conditionals; instead, they use the same node as `if` but make it a consequent of other `if` nodes. This commit removes the `Elsif` node and combines its functionality with `IfNode`, ensuring that both the parsing and formatting logic are still functional.
And add `beginning` kwarg to `IfNode` DSL method.
@kddnewton Thanks for the feedback! I think I've implemented all the changes you requested. The big ones were:
|
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 is so good!
@egiurleo I ended up merging this into the |
Related to #278. Completed with @bitwise-aiden.
This PR eliminates the
Elsif
node and folds its functionality intoIfNode
. Now,elsif
conditional statements will be represented withIfNodes
that are the consequent of anotherIfNode
. This eliminates an unnecessary node type from syntax tree, simplifies a lot of logic, and brings syntax tree closer to other AST representations of Ruby.