-
Notifications
You must be signed in to change notification settings - Fork 23
fix(query): fix multiple predicates being parsed incorrectly #165
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
base: master
Are you sure you want to change the base?
Conversation
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.
It might be better to have a separate function for each predicate type (and one for the settings) and keep the if logic in the original function.
| for (long j = 0; j < steps; ++j) { | ||
| long nargs = 0; | ||
| for (; ; ++nargs) { |
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.
| for (long j = 0; j < steps; ++j) { | |
| long nargs = 0; | |
| for (; ; ++nargs) { | |
| for (long j = 0, nargs; j < steps; ++j) { | |
| for (nargs = 0; ; ++nargs) { |
Assuming this works.
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 guess that works, but would that be really that useful? I don't think it helps with readability that much, and that enclosing for does not refer to nargs in the 'condition' or the 'step', so is there really any value in declaring the local variable in its 'init'?
Though if you prefer I can make that change nonetheless.
e5ab2f3 to
e355c2f
Compare
Have tried to implement this now, I hope that is (roughly) what you had in mind. Let me know if you want something changed, or feel free to edit it yourself in case that is easier. |
Previously
nargswas not reset to 0 for subsequent predicates. If those predicates had the same number or more arguments, this was not noticeable. However, if the subsequent predicates had less arguments, this lead to out-of-bounds access causing undefined behavior.This PR consists of two commits:
handlePredicatemethod to make it a bit easier to understandIf you want feel free to edit or omit the second commit if you don't think it is useful.