From 77c57674e8bd43ef95144fa76ee97b67c3d28258 Mon Sep 17 00:00:00 2001 From: belliash Date: Fri, 17 May 2019 19:54:32 +0200 Subject: [PATCH] Allow private methods redeclaration. --- engine/oop.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/engine/oop.c b/engine/oop.c index 3d5d8b4..e23ace0 100644 --- a/engine/oop.c +++ b/engine/oop.c @@ -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 */