Implement '$base' construction.
所有检测均成功
The build was successful.

这个提交包含在:
Rafal Kupiec 2019-05-21 21:41:16 +02:00
父节点 d8db20e9bd
当前提交 5b2f300fe4
签署人:: belliash
GPG 密钥 ID: 4E829243E0CFE6B4

查看文件

@ -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);