Fix Operand treating a "false"-valued variable as boolean true
When resolving a bare $[var]/#[var] reference, Operand set .boolean = true whenever the value's text was EITHER "true" OR "false" - effectively "boolean = looks-boolean-ish" rather than reflecting which of the two it actually was. <if expr="..">/<while expr="..">check exactly this .boolean field (see __if.cpp/__while.cpp), so <if expr="$[flag]"> took the true branch even when flag held the literal text "false". Fixed to boolean = (string == "true"). Verified live: a variable set to value="false" now correctly takes an <if expr="$[var]">'s false branch, and value="true" still correctly takes the true branch. Re-ran tests/posttest.sh - unaffected, no regression. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f33c041ae5
commit
aaed4cb4da
1 file changed
+1
-1
+1
-1
@@ -21,7 +21,7 @@ namespace jet {
|
|||||||
isNumber = string.eod();
|
isNumber = string.eod();
|
||||||
string.reset();
|
string.reset();
|
||||||
if((string == "false") || (string == "true"))
|
if((string == "false") || (string == "true"))
|
||||||
boolean = true;
|
boolean = (string == "true");
|
||||||
} else if(in.ifNext("(")) {
|
} else if(in.ifNext("(")) {
|
||||||
Operand op(in, tag);
|
Operand op(in, tag);
|
||||||
string = op.string;
|
string = op.string;
|
||||||
|
|||||||
Reference in new issue
Block a user