-
Notifications
You must be signed in to change notification settings - Fork 200
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
+ builder: emit implicit hash passed to a method call as kwargs #769
+ builder: emit implicit hash passed to a method call as kwargs #769
Conversation
@marcandre Could you take a look, too, please? (can't find you in "Reviewers" dropdown) |
18dab11
to
33d8b4b
Compare
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.
The implementation surprises me. It was too difficult to emit the right node type from the get go?
# | ||
# ``` | ||
# (send nil :foo | ||
# (hash |
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.
^hash^kwargs
Yes and no, it's relatively simple. We rewrite either the last arg (if it's a hash) or the 2nd last (if it's a hash AND the last argument is a block). Rules are not trivial, and so the implementation takes 5 lines. The rest of the diff is about docs/tests. (just in case) If you are talking about rewriting it in the |
I meant that looking in |
Yes, I had a similar idea, but there's a single exception -
Here Also by looking deeper at the grammar I've realized that it would affect |
Or maybe it's safer to rewrite it at the very beginning and un-rewrite in indexasgn. Yes, it seems to be the only exception, all other branches end up doing |
I give up on moving it to the grammar level. On 1.8 (huh) Added |
Closes #761.