This commit is contained in:
parent
d8db20e9bd
commit
5b2f300fe4
11
engine/vm.c
11
engine/vm.c
@ -4570,7 +4570,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 += 2;
|
pThis->iRef += 3;
|
||||||
pClass = pThis->pClass;
|
pClass = pThis->pClass;
|
||||||
if(pTarget->iFlags == MEMOBJ_PARENTOBJ) {
|
if(pTarget->iFlags == MEMOBJ_PARENTOBJ) {
|
||||||
/* Parent called */
|
/* Parent called */
|
||||||
@ -4643,6 +4643,15 @@ 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);
|
||||||
|
Loading…
Reference in New Issue
Block a user