Fix #3616 IfStatement requires double parentheses when dividing #3626
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Target
Try to fix #3616
Debug analysis
If you write
less
(v4 parens-division default) code like follow:VSCode debug screen snapshot
Call Stack
ParseTree -> ruleset eval -> declaration eval -> value eval -> expression eval -> call eval -> functionCaller.call -> If -> operation eval
bar2: if(false, 666, (666 / 333));
bar2: 2;
bar2: 666 / 333;
In our expacted logic the
Operation
's eval output should be aUnit
which value is2
.The
Operation
's eval logicOur
context
loseparens
!!!So the
context.isMathOn(this.op)
is failed.I know my analysis is not very clear, but I think maintainers know what i say. Hope this PR is useful, maintainers can modify my code directly cause i am not a
less
source code expert. Any help welcome./cc @matthew-dean