Generally speaking ... this is working.
This commit partially fixes #5, however it still needs some work. TODO: * remove debugging printf calls, * some tuning, to consume less memory, * implement similar solution for interfaces
This commit is contained in:
26
engine/oop.c
26
engine/oop.c
@@ -218,7 +218,7 @@ PH7_PRIVATE sxi32 PH7_ClassInstallMethod(ph7_class *pClass, ph7_class_method *pM
|
||||
* Any other return value indicates failure and the upper layer must generate an appropriate
|
||||
* error message.
|
||||
*/
|
||||
PH7_PRIVATE sxi32 PH7_ClassInherit(ph7_gen_state *pGen, ph7_class *pSub, ph7_class *pBase) {
|
||||
PH7_PRIVATE sxi32 PH7_ClassInherit(ph7_class *pSub, ph7_class *pBase) {
|
||||
ph7_class_method *pMeth;
|
||||
ph7_class_attr *pAttr;
|
||||
SyHashEntry *pEntry;
|
||||
@@ -239,9 +239,9 @@ PH7_PRIVATE sxi32 PH7_ClassInherit(ph7_gen_state *pGen, ph7_class *pSub, ph7_cla
|
||||
if(pAttr->iProtection == PH7_CLASS_PROT_PRIVATE &&
|
||||
((ph7_class_attr *)pEntry->pUserData)->iProtection != PH7_CLASS_PROT_PUBLIC) {
|
||||
/* Cannot redeclare private attribute */
|
||||
PH7_GenCompileError(&(*pGen), E_WARNING, ((ph7_class_attr *)pEntry->pUserData)->nLine,
|
||||
"Private attribute '%z::%z' redeclared inside child class '%z'",
|
||||
&pBase->sName, pName, &pSub->sName);
|
||||
// PH7_GenCompileError(&(*pGen), E_WARNING, ((ph7_class_attr *)pEntry->pUserData)->nLine,
|
||||
// "Private attribute '%z::%z' redeclared inside child class '%z'",
|
||||
// &pBase->sName, pName, &pSub->sName);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -261,20 +261,20 @@ PH7_PRIVATE sxi32 PH7_ClassInherit(ph7_gen_state *pGen, ph7_class *pSub, ph7_cla
|
||||
if((pEntry = SyHashGet(&pSub->hMethod, (const void *)pName->zString, pName->nByte)) != 0) {
|
||||
if(pMeth->iFlags & PH7_CLASS_ATTR_FINAL) {
|
||||
/* Cannot Overwrite final method */
|
||||
rc = PH7_GenCompileError(&(*pGen), E_ERROR, ((ph7_class_method *)pEntry->pUserData)->nLine,
|
||||
"Cannot Overwrite final method '%z:%z' inside child class '%z'",
|
||||
&pBase->sName, pName, &pSub->sName);
|
||||
if(rc == SXERR_ABORT) {
|
||||
return SXERR_ABORT;
|
||||
}
|
||||
// rc = PH7_GenCompileError(&(*pGen), E_ERROR, ((ph7_class_method *)pEntry->pUserData)->nLine,
|
||||
// "Cannot Overwrite final method '%z:%z' inside child class '%z'",
|
||||
// &pBase->sName, pName, &pSub->sName);
|
||||
// if(rc == SXERR_ABORT) {
|
||||
// return SXERR_ABORT;
|
||||
// }
|
||||
}
|
||||
continue;
|
||||
} else {
|
||||
if(pMeth->iFlags & PH7_CLASS_ATTR_ABSTRACT) {
|
||||
/* Abstract method must be defined in the child class */
|
||||
PH7_GenCompileError(&(*pGen), E_WARNING, pMeth->nLine,
|
||||
"Abstract method '%z:%z' must be defined inside child class '%z'",
|
||||
&pBase->sName, pName, &pSub->sName);
|
||||
// PH7_GenCompileError(&(*pGen), E_WARNING, pMeth->nLine,
|
||||
// "Abstract method '%z:%z' must be defined inside child class '%z'",
|
||||
// &pBase->sName, pName, &pSub->sName);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user