Skip to content

Combine LambdaVar node with BlockVar #303

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

Closed
wants to merge 4 commits into from

Conversation

egiurleo
Copy link
Contributor

@egiurleo egiurleo commented Feb 9, 2023

Related to #278.

This PR combines the LambdaVar node with BlockVar. Now, any params on blocks or lambdas will be represented by a BlockVar node. This removes an unnecessary node from syntax tree, which simplifies logic and brings syntax tree closer to other Ruby AST implementations.

@egiurleo egiurleo marked this pull request as ready for review February 9, 2023 20:52
q.text("|")
q.group do
q.remove_breaks(q.format(params))
pipe? ? q.remove_breaks(q.format(params)) : q.format(params)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I managed to move the first two lines of this method into BlockNode, but I"m having trouble with q.remove_breaks because the tests seem to expect that all params within pipes are on the same line. Any suggestions?

Both `LambdaVar` and `BlockVar` represent a collection of arguments
(positional, optional, keyword, block) as well as block or lambda-local
variables. This commit removes the `LambdaVar` node and folds its
functionality into the `BlockVar` node, which reduces the number of
nodes and simplifies logic.
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.

2 participants