Clean up $base statement.
The build was successful.
Details
The build was successful.
Details
This commit is contained in:
parent
fd278b1f47
commit
b1b78433dd
20
engine/vm.c
20
engine/vm.c
|
@ -4154,14 +4154,11 @@ static sxi32 VmByteCodeExec(
|
||||||
pThis = (ph7_class_instance *)pNos->x.pOther;
|
pThis = (ph7_class_instance *)pNos->x.pOther;
|
||||||
/* Point to the instantiated class */
|
/* Point to the instantiated class */
|
||||||
pClass = pThis->pClass;
|
pClass = pThis->pClass;
|
||||||
if(pNos->iFlags == MEMOBJ_BASEOBJ || pNos->iFlags == MEMOBJ_PARENTOBJ) {
|
if(pNos->iFlags == MEMOBJ_PARENTOBJ) {
|
||||||
if(pClass->pBase == 0) {
|
if(pClass->pBase == 0) {
|
||||||
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR,
|
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR,
|
||||||
"Attempt to call parent class from non-inheritance instance of class '%z'", &pClass->sName);
|
"Attempt to call parent class from non-inheritance instance of class '%z'", &pClass->sName);
|
||||||
}
|
}
|
||||||
if(pNos->iFlags == MEMOBJ_BASEOBJ) {
|
|
||||||
pClass = pClass->pBase;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* Extract attribute name first */
|
/* Extract attribute name first */
|
||||||
SyStringInitFromBuf(&sName, (const char *)SyBlobData(&pTos->sBlob), SyBlobLength(&pTos->sBlob));
|
SyStringInitFromBuf(&sName, (const char *)SyBlobData(&pTos->sBlob), SyBlobLength(&pTos->sBlob));
|
||||||
|
@ -4173,7 +4170,7 @@ static sxi32 VmByteCodeExec(
|
||||||
if(pNos->iFlags != MEMOBJ_PARENTOBJ) {
|
if(pNos->iFlags != MEMOBJ_PARENTOBJ) {
|
||||||
pMeth = PH7_ClassExtractMethod(pClass, sName.zString, sName.nByte);
|
pMeth = PH7_ClassExtractMethod(pClass, sName.zString, sName.nByte);
|
||||||
}
|
}
|
||||||
if(pMeth == 0 && pNos->iFlags != MEMOBJ_BASEOBJ) {
|
if(pMeth == 0) {
|
||||||
/* Browse hashtable from the beginning */
|
/* Browse hashtable from the beginning */
|
||||||
SyHashResetLoopCursor(&pClass->hDerived);
|
SyHashResetLoopCursor(&pClass->hDerived);
|
||||||
/* Search for appropriate class member */
|
/* Search for appropriate class member */
|
||||||
|
@ -4215,7 +4212,7 @@ static sxi32 VmByteCodeExec(
|
||||||
if(SyStrncmp(pObjAttr->pAttr->sName.zString, sName.zString, sName.nByte) == 0) {
|
if(SyStrncmp(pObjAttr->pAttr->sName.zString, sName.zString, sName.nByte) == 0) {
|
||||||
if(pNos->iFlags != MEMOBJ_PARENTOBJ && pObjAttr->pAttr->pClass == pClass) {
|
if(pNos->iFlags != MEMOBJ_PARENTOBJ && pObjAttr->pAttr->pClass == pClass) {
|
||||||
break;
|
break;
|
||||||
} else if(pNos->iFlags != MEMOBJ_BASEOBJ) {
|
} else {
|
||||||
SyHashEntry *pDerived = SyHashGet(&pClass->hDerived, (const void *)pObjAttr->pAttr->pClass->sName.zString, pObjAttr->pAttr->pClass->sName.nByte);
|
SyHashEntry *pDerived = SyHashGet(&pClass->hDerived, (const void *)pObjAttr->pAttr->pClass->sName.zString, pObjAttr->pAttr->pClass->sName.nByte);
|
||||||
if(pDerived != 0) {
|
if(pDerived != 0) {
|
||||||
ph7_class *pSub = (ph7_class *)pDerived->pUserData;
|
ph7_class *pSub = (ph7_class *)pDerived->pUserData;
|
||||||
|
@ -4610,7 +4607,7 @@ static sxi32 VmByteCodeExec(
|
||||||
if(pTarget->nType & MEMOBJ_OBJ) {
|
if(pTarget->nType & MEMOBJ_OBJ) {
|
||||||
/* Instance already loaded */
|
/* Instance already loaded */
|
||||||
pThis = (ph7_class_instance *)pTarget->x.pOther;
|
pThis = (ph7_class_instance *)pTarget->x.pOther;
|
||||||
pThis->iRef += 3;
|
pThis->iRef += 2;
|
||||||
pClass = pThis->pClass;
|
pClass = pThis->pClass;
|
||||||
pThis->pClass = pVmFunc->pClass;
|
pThis->pClass = pVmFunc->pClass;
|
||||||
pSelf = pThis->pClass;
|
pSelf = pThis->pClass;
|
||||||
|
@ -4665,15 +4662,6 @@ static sxi32 VmByteCodeExec(
|
||||||
PH7_VmMemoryError(&(*pVm));
|
PH7_VmMemoryError(&(*pVm));
|
||||||
}
|
}
|
||||||
if(pVmFunc->iFlags & VM_FUNC_CLASS_METHOD) {
|
if(pVmFunc->iFlags & VM_FUNC_CLASS_METHOD) {
|
||||||
/* Install the '$base' variable */
|
|
||||||
static const SyString sBase = { "base", sizeof("base") - 1 };
|
|
||||||
pObj = VmCreateMemObj(&(*pVm), &sBase, TRUE);
|
|
||||||
if(pObj) {
|
|
||||||
/* Reflect the change */
|
|
||||||
pObj->iFlags = MEMOBJ_BASEOBJ;
|
|
||||||
pObj->x.pOther = pThis;
|
|
||||||
MemObjSetType(pObj, MEMOBJ_OBJ);
|
|
||||||
}
|
|
||||||
/* Install the '$parent' variable */
|
/* Install the '$parent' variable */
|
||||||
static const SyString sParent = { "parent", sizeof("parent") - 1 };
|
static const SyString sParent = { "parent", sizeof("parent") - 1 };
|
||||||
pObj = VmCreateMemObj(&(*pVm), &sParent, TRUE);
|
pObj = VmCreateMemObj(&(*pVm), &sParent, TRUE);
|
||||||
|
|
|
@ -632,9 +632,8 @@ struct ph7_value {
|
||||||
};
|
};
|
||||||
/* Variable control flags */
|
/* Variable control flags */
|
||||||
#define MEMOBJ_VARIABLE 0 /* Memory value is variable */
|
#define MEMOBJ_VARIABLE 0 /* Memory value is variable */
|
||||||
#define MEMOBJ_BASEOBJ 1 /* Memory value is 'base' object */
|
#define MEMOBJ_PARENTOBJ 1 /* Memory value is 'parent' object */
|
||||||
#define MEMOBJ_PARENTOBJ 2 /* Memory value is 'parent' object */
|
#define MEMOBJ_THISOBJ 2 /* Memory value is 'this' object */
|
||||||
#define MEMOBJ_THISOBJ 3 /* Memory value is 'this' object */
|
|
||||||
/* Allowed variable data types.
|
/* Allowed variable data types.
|
||||||
*/
|
*/
|
||||||
#define MEMOBJ_BOOL 0x0001 /* Memory value is a boolean */
|
#define MEMOBJ_BOOL 0x0001 /* Memory value is a boolean */
|
||||||
|
|
Loading…
Reference in New Issue