2 bugs fixed:

empty string will be true in conditional expressions,but now it is false(and string that is not empty and is not numerable will be true)

foreach(var i;func(){return []}()); will cause sigsegv because codegen generates error op_pop and op_cntpop,now the counter in_foreach and in_forindex change after generating
foreach/forindex expression before block generation.
This commit is contained in:
ValKmjolnir
2021-11-14 23:05:34 +08:00
parent cd08b2d1bb
commit 6a35c58df4
2 changed files with 9 additions and 7 deletions
+1 -1
View File
@@ -284,7 +284,7 @@ inline bool nasal_vm::condition(nasal_ref val)
{
double num=str2num(val.str()->c_str());
if(std::isnan(num))
return val.str()->empty();
return !val.str()->empty();
return num;
}
return false;