Browse Source

Allow private methods redeclaration.

release/v0.1
Rafal Kupiec 1 year ago
parent
commit
77c57674e8
Signed by: belliash GPG Key ID: 4E829243E0CFE6B4
1 changed files with 4 additions and 6 deletions
  1. +4
    -6
      engine/oop.c

+ 4
- 6
engine/oop.c View File

@ -265,7 +265,7 @@ PH7_PRIVATE sxi32 PH7_ClassInherit(ph7_vm *pVm, ph7_class *pSub, ph7_class *pBas
}
SyHashResetLoopCursor(&pBase->hMethod);
while((pEntry = SyHashGetNextEntry(&pBase->hMethod)) != 0) {
/* Make sure the private/final methods are not redeclared in the subclass */
/* Make sure the final methods are not redeclared in the subclass */
pMeth = (ph7_class_method *)pEntry->pUserData;
pName = &pMeth->sFunc.sName;
if((pEntry = SyHashGet(&pSub->hMethod, (const void *)pName->zString, pName->nByte)) != 0) {
@ -281,11 +281,9 @@ PH7_PRIVATE sxi32 PH7_ClassInherit(ph7_vm *pVm, ph7_class *pSub, ph7_class *pBas
}
}
/* Install the method */
if(pMeth->iProtection != PH7_CLASS_PROT_PRIVATE) {
rc = SyHashInsert(&pSub->hMethod, (const void *)pName->zString, pName->nByte, pMeth);
if(rc != SXRET_OK) {
return rc;
}
rc = SyHashInsert(&pSub->hMethod, (const void *)pName->zString, pName->nByte, pMeth);
if(rc != SXRET_OK) {
return rc;
}
}
/* Mark first inherited class as direct subclass */

Loading…
Cancel
Save