Implement a NULL-coalescing '??' operator.
All checks were successful
The build was successful.

This commit is contained in:
2019-06-21 00:34:41 +02:00
parent 6d964d6113
commit dcf37af75e
3 changed files with 42 additions and 1 deletions

View File

@@ -3879,6 +3879,16 @@ static sxi32 VmByteCodeExec(
}
break;
}
case PH7_OP_NULLC: {
ph7_value *pNos = &pTos[-1];
int rc;
rc = PH7_MemObjIsNull(pTos);
if(!rc) {
PH7_MemObjStore(pTos, pNos);
}
VmPopOperand(&pTos, 1);
break;
}
/*
* OP_LOAD_EXCEPTION * P2 P3
* Push an exception in the corresponding container so that
@@ -5381,6 +5391,9 @@ static const char *VmInstrToString(sxi32 nOp) {
case PH7_OP_NEQ:
zOp = "NEQ";
break;
case PH7_OP_NULLC:
zOp = "NULLC";
break;
case PH7_OP_BAND:
zOp = "BITAND";
break;