Implement short-circuit evaluation for the null coalescing operator
Build / AerScript (push) Successful in 40s

This commit is contained in:
2026-10-24 00:30:45 +02:00
parent 18e6da6c08
commit 323793153c
2 changed files with 26 additions and 0 deletions
+7
View File
@@ -2344,11 +2344,18 @@ static sxi32 VmByteCodeExec(
*
* Take the jump if the top value is not zero (TRUE jump).Pop the top most
* entry in the stack if P1 is zero.
* If P1 is 2, test for a non-empty value without converting or popping it.
*/
case PH7_OP_JMPNZ:
if(pTos < pStack) {
goto Abort;
}
if(pInstr->iP1 == 2) {
if(!PH7_MemObjIsNull(pTos)) {
pc = pInstr->iP2 - 1;
}
break;
}
/* Get a boolean value */
if((pTos->nType & MEMOBJ_BOOL) == 0) {
PH7_MemObjToBool(pTos);