Allow OP_IS to check for type def and value.
The build was successful. Details

This commit is contained in:
Rafal Kupiec 2019-06-07 12:33:56 +02:00
parent fa5c2e1f5e
commit 6c449dbdbf
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
1 changed files with 32 additions and 14 deletions

View File

@ -2351,21 +2351,39 @@ static sxi32 VmByteCodeExec(
goto Abort; goto Abort;
} }
#endif #endif
if(pNos->nType & MEMOBJ_OBJ) { VmInstr *bInstr = &aInstr[pc - 1];
ph7_class_instance *pThis = (ph7_class_instance *)pNos->x.pOther; if(pInstr->iP2) {
ph7_class *pClass = 0; sxu32 nType = pNos->nType;
/* Extract the target class */ if(nType & MEMOBJ_MIXED) {
if(pTos->nType & MEMOBJ_OBJ) { nType ^= MEMOBJ_MIXED;
/* Instance already loaded */
pClass = ((ph7_class_instance *)pTos->x.pOther)->pClass;
} else if(pTos->nType & MEMOBJ_STRING && SyBlobLength(&pTos->sBlob) > 0) {
/* Perform the query */
pClass = PH7_VmExtractClass(&(*pVm), (const char *)SyBlobData(&pTos->sBlob),
SyBlobLength(&pTos->sBlob), FALSE);
} }
if(pClass) { if(nType == pInstr->iP2) {
/* Perform the query */ iRes = 1;
iRes = VmInstanceOf(pThis->pClass, pClass); }
} else {
if(pNos->nType & MEMOBJ_OBJ) {
ph7_class_instance *pThis = (ph7_class_instance *)pNos->x.pOther;
ph7_class *pClass = 0;
/* Extract the target class */
if(pTos->nType & MEMOBJ_OBJ && pTos->x.pOther) {
/* Instance already loaded */
pClass = ((ph7_class_instance *)pTos->x.pOther)->pClass;
} else if(pTos->nType & MEMOBJ_STRING && SyBlobLength(&pTos->sBlob) > 0) {
/* Perform the query */
pClass = PH7_VmExtractClass(&(*pVm), (const char *)SyBlobData(&pTos->sBlob),
SyBlobLength(&pTos->sBlob), FALSE);
}
if(pClass == 0) {
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR,
"The type or class name could not be found");
}
if(pThis) {
/* Perform the query */
iRes = VmInstanceOf(pThis->pClass, pClass);
}
} else {
rc = PH7_MemObjCmp(pNos, pTos, FALSE, 0);
iRes = rc == 0;
} }
} }
/* Push result */ /* Push result */