This commit is contained in:
parent
5eeceb6927
commit
01c210984e
20
engine/vm.c
20
engine/vm.c
@ -636,14 +636,14 @@ static sxi32 VmMountUserClass(
|
|||||||
if(pMemObj == 0 || pResult == 0) {
|
if(pMemObj == 0 || pResult == 0) {
|
||||||
PH7_VmMemoryError(&(*pVm));
|
PH7_VmMemoryError(&(*pVm));
|
||||||
}
|
}
|
||||||
|
MemObjSetType(pMemObj, pAttr->nType);
|
||||||
if(SySetUsed(&pAttr->aByteCode) > 0) {
|
if(SySetUsed(&pAttr->aByteCode) > 0) {
|
||||||
/* Initialize attribute default value (any complex expression) */
|
/* Initialize attribute default value (any complex expression) */
|
||||||
VmLocalExec(&(*pVm), &pAttr->aByteCode, pResult);
|
VmLocalExec(&(*pVm), &pAttr->aByteCode, pResult);
|
||||||
}
|
rc = PH7_MemObjSafeStore(pResult, pMemObj);
|
||||||
MemObjSetType(pMemObj, pAttr->nType);
|
if(rc != SXRET_OK) {
|
||||||
rc = PH7_MemObjSafeStore(pResult, pMemObj);
|
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Cannot assign a value of incompatible type to variable '%z::$%z'", &pClass->sName, &pAttr->sName);
|
||||||
if(rc != SXRET_OK) {
|
}
|
||||||
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Cannot assign a value of incompatible type to variable '%z::$%z'", &pClass->sName, &pAttr->sName);
|
|
||||||
}
|
}
|
||||||
/* Free up memory */
|
/* Free up memory */
|
||||||
PH7_MemObjRelease(pResult);
|
PH7_MemObjRelease(pResult);
|
||||||
@ -704,14 +704,14 @@ PH7_PRIVATE sxi32 PH7_VmCreateClassInstanceFrame(
|
|||||||
SyMemBackendPoolFree(&pVm->sAllocator, pVmAttr);
|
SyMemBackendPoolFree(&pVm->sAllocator, pVmAttr);
|
||||||
return SXERR_MEM;
|
return SXERR_MEM;
|
||||||
}
|
}
|
||||||
|
MemObjSetType(pMemObj, pAttr->nType);
|
||||||
if(SySetUsed(&pAttr->aByteCode) > 0) {
|
if(SySetUsed(&pAttr->aByteCode) > 0) {
|
||||||
/* Initialize attribute default value (any complex expression) */
|
/* Initialize attribute default value (any complex expression) */
|
||||||
VmLocalExec(&(*pVm), &pAttr->aByteCode, pResult);
|
VmLocalExec(&(*pVm), &pAttr->aByteCode, pResult);
|
||||||
}
|
rc = PH7_MemObjSafeStore(pResult, pMemObj);
|
||||||
MemObjSetType(pMemObj, pAttr->nType);
|
if(rc != SXRET_OK) {
|
||||||
rc = PH7_MemObjSafeStore(pResult, pMemObj);
|
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Cannot assign a value of incompatible type to variable '%z::$%z'", &pClass->sName, &pAttr->sName);
|
||||||
if(rc != SXRET_OK) {
|
}
|
||||||
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Cannot assign a value of incompatible type to variable '%z::$%z'", &pClass->sName, &pAttr->sName);
|
|
||||||
}
|
}
|
||||||
/* Free up memory */
|
/* Free up memory */
|
||||||
PH7_MemObjRelease(pResult);
|
PH7_MemObjRelease(pResult);
|
||||||
|
Loading…
Reference in New Issue
Block a user