-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Fix issues related to passing arguments to funcall and predicates #5539
Conversation
7521f07
to
54bbe80
Compare
The changes look good to me. Just two small notes:
|
665f326
to
03e37bd
Compare
- Any predicate method call was able to receive only a single argument, otherwise an error was thrown during compilation - The reason is because the `compile_arg` method was stumbling into the `,` token (used to split earch args)
03e37bd
to
1fa99eb
Compare
- Passing argument to funcall (any numbers) wasn't working, the ruby code generate from the compiler wasn't valid, a closing parenthesis was misplaced. The code was looking something like ``` # Before (my_method(node0), arg1, arg2) # After (my_method(node0, arg1, arg2)) ```
1fa99eb
to
8c56b94
Compare
Thanks for the quick feedback. I have made the requested changes |
Thanks for working on this! I really appreciate it! 🙇 |
args | ||
index = tokens.find_index { |token| token == ')' } | ||
|
||
tokens.slice!(0..index).each_with_object([]) do |token, args| |
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.
Is it safe to mutate the passed in array here?
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.
👋 , if you are talking about the tokens
array then I believe it should be safe to mutate it, well at least the previous implementation was already mutating it
Hey guys, thanks for creating and maintaining this gem 😸
This PR fixes 2 issues I found with the compiler:
Fixed an issue with multiple args on predicates:
compile_arg
method was stumbling into the,
token (used to split earch args)Fixed an issue when funcall were passed argument: