-
Notifications
You must be signed in to change notification settings - Fork 174
Fix on_* return value of ripper translator
#3865
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
Conversation
|
Somewhat unsure about this fix but it seems to work very well. |
| def _dispatch_0; end | ||
| def _dispatch_1(_); end | ||
| def _dispatch_2(_, _); end | ||
| def _dispatch_3(_, _, _); end | ||
| def _dispatch_4(_, _, _, _); end | ||
| def _dispatch_5(_, _, _, _, _); end | ||
| def _dispatch_7(_, _, _, _, _, _, _); end | ||
| def _dispatch_1(arg); arg end | ||
| def _dispatch_2(arg, _); arg end | ||
| def _dispatch_3(arg, _, _); arg end | ||
| def _dispatch_4(arg, _, _, _); arg end | ||
| def _dispatch_5(arg, _, _, _, _); arg end | ||
| def _dispatch_7(arg, _, _, _, _, _, _); arg end |
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.
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.
I wonder why we didn't/don't just copy that part from upstream.
Maybe the unused variables cause warnings?
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.
Ah, nice. I was mostly just guessing but this makes it pretty clear.
eregon
left a comment
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.
Nice, thank you!
You're supposed to return the first argument. ```rb # Before [[:stmts_new], [:rescue_mod, nil, nil], [:stmts_add, nil, nil], [:program, nil]] # After [[:stmts_new], [:rescue_mod, "1", "2"], [:stmts_add, nil, "1"], [:program, nil]] ``` The correct result would be: `[[:rescue_mod, "1", "2"], [:stmts_new], [:stmts_add, nil, "1"], [:program, nil]]` But the order depends on the prism AST so it seems very difficult to match.
6aa3a04 to
94e0107
Compare
You're supposed to return the first argument.
The correct result would be:
[[:rescue_mod, "1", "2"], [:stmts_new], [:stmts_add, nil, "1"], [:program, nil]]But the order depends on the prism AST so it seems very difficult to match.
Ref: #3838