Another fixes to OOP-related error reporting.
The build was successful. Details

This commit is contained in:
Rafal Kupiec 2019-05-30 20:18:20 +02:00
parent feba01eb49
commit 53199cac4e
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
3 changed files with 4 additions and 4 deletions

View File

@ -3458,7 +3458,7 @@ static sxi32 PH7_GenStateCompileClassMethod(
/* Only method signature is allowed */
if(pGen->pIn < pGen->pEnd && (pGen->pIn->nType & PH7_TK_SEMI /* ';'*/) == 0) {
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 */

View File

@ -282,7 +282,7 @@ PH7_PRIVATE sxi32 PH7_ClassInherit(ph7_vm *pVm, ph7_class *pSub, ph7_class *pBas
} else {
if(pMeth->iFlags & PH7_CLASS_ATTR_VIRTUAL) {
/* 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 */

View File

@ -4331,7 +4331,7 @@ static sxi32 VmByteCodeExec(
}
PH7_MemObjRelease(pTos);
} 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);
} else if(!VmClassMemberAccess(&(*pVm), pClass, pMeth->iProtection)) {
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->iFlags & (PH7_CLASS_ATTR_STATIC | PH7_CLASS_ATTR_CONSTANT)) == 0) {
/* 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
);
} else {