This commit is contained in:
parent
feba01eb49
commit
53199cac4e
@ -3458,7 +3458,7 @@ static sxi32 PH7_GenStateCompileClassMethod(
|
|||||||
/* Only method signature is allowed */
|
/* Only method signature is allowed */
|
||||||
if(pGen->pIn < pGen->pEnd && (pGen->pIn->nType & PH7_TK_SEMI /* ';'*/) == 0) {
|
if(pGen->pIn < pGen->pEnd && (pGen->pIn->nType & PH7_TK_SEMI /* ';'*/) == 0) {
|
||||||
PH7_GenCompileError(pGen, E_ERROR, pGen->pIn->nLine,
|
PH7_GenCompileError(pGen, E_ERROR, pGen->pIn->nLine,
|
||||||
"Interface method '%z::%z()' cannot contain body", &pClass->sName, pName);
|
"Interface or virtual method '%z::%z()' cannot contain body", &pClass->sName, pName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Store method return data type */
|
/* Store method return data type */
|
||||||
|
@ -282,7 +282,7 @@ PH7_PRIVATE sxi32 PH7_ClassInherit(ph7_vm *pVm, ph7_class *pSub, ph7_class *pBas
|
|||||||
} else {
|
} else {
|
||||||
if(pMeth->iFlags & PH7_CLASS_ATTR_VIRTUAL) {
|
if(pMeth->iFlags & PH7_CLASS_ATTR_VIRTUAL) {
|
||||||
/* Virtual method must be defined in the child class */
|
/* Virtual method must be defined in the child class */
|
||||||
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Virtual method '%z:%z()' must be defined inside child class '%z'", &pBase->sName, pName, &pSub->sName);
|
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Virtual method '%z::%z()' must be defined inside child class '%z'", &pBase->sName, pName, &pSub->sName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Install the method */
|
/* Install the method */
|
||||||
|
@ -4331,7 +4331,7 @@ static sxi32 VmByteCodeExec(
|
|||||||
}
|
}
|
||||||
PH7_MemObjRelease(pTos);
|
PH7_MemObjRelease(pTos);
|
||||||
} else if((pMeth->iFlags & PH7_CLASS_ATTR_STATIC) == 0 && ((pClass->iFlags & PH7_CLASS_FINAL) == 0 || (pClass->iFlags & PH7_CLASS_VIRTUAL) == 0)) {
|
} else if((pMeth->iFlags & PH7_CLASS_ATTR_STATIC) == 0 && ((pClass->iFlags & PH7_CLASS_FINAL) == 0 || (pClass->iFlags & PH7_CLASS_VIRTUAL) == 0)) {
|
||||||
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Attempt to call statically a non-static method '%z::%z()'",
|
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "An object reference is required for the non-static method '%z::%z()'",
|
||||||
&pClass->sName, &sName);
|
&pClass->sName, &sName);
|
||||||
} else if(!VmClassMemberAccess(&(*pVm), pClass, pMeth->iProtection)) {
|
} else if(!VmClassMemberAccess(&(*pVm), pClass, pMeth->iProtection)) {
|
||||||
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Method '%z::%z()' is inaccessible due to its protection level",
|
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Method '%z::%z()' is inaccessible due to its protection level",
|
||||||
@ -4364,7 +4364,7 @@ static sxi32 VmByteCodeExec(
|
|||||||
if(pAttr) {
|
if(pAttr) {
|
||||||
if((pAttr->iFlags & (PH7_CLASS_ATTR_STATIC | PH7_CLASS_ATTR_CONSTANT)) == 0) {
|
if((pAttr->iFlags & (PH7_CLASS_ATTR_STATIC | PH7_CLASS_ATTR_CONSTANT)) == 0) {
|
||||||
/* Access to a non static attribute */
|
/* Access to a non static attribute */
|
||||||
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Access to a non-static class attribute '%z::$%z'",
|
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "An object reference is required for the non-static attribute '%z::$%z'",
|
||||||
&pClass->sName, &pAttr->sName
|
&pClass->sName, &pAttr->sName
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user