From 9b1ad67580ff4b3434943020941e8ffcc9dcaa6e Mon Sep 17 00:00:00 2001 From: belliash Date: Wed, 24 Apr 2019 18:09:41 +0200 Subject: [PATCH] PH7_VmThrowError() always breaks script execution on PH7_CTX_ERR. Thus code placed below will never get executed and is completely useless. --- engine/oop.c | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/engine/oop.c b/engine/oop.c index 45bacad..b622a0f 100644 --- a/engine/oop.c +++ b/engine/oop.c @@ -255,10 +255,7 @@ PH7_PRIVATE sxi32 PH7_ClassInherit(ph7_vm *pVm, ph7_class *pSub, ph7_class *pBas if((pEntry = SyHashGet(&pSub->hAttr, (const void *)pName->zString, pName->nByte)) != 0) { if(pAttr->iProtection == PH7_CLASS_PROT_PRIVATE && ((ph7_class_attr *)pEntry->pUserData)->iProtection != PH7_CLASS_PROT_PUBLIC) { /* Cannot redeclare private attribute */ - rc = PH7_VmThrowError(pVm, PH7_CTX_ERR, "Private attribute '%z::%z' redeclared inside child class '%z'", &pBase->sName, pName, &pSub->sName); - if(rc == SXERR_ABORT) { - return SXERR_ABORT; - } + PH7_VmThrowError(pVm, PH7_CTX_ERR, "Private attribute '%z::%z' redeclared inside child class '%z'", &pBase->sName, pName, &pSub->sName); } continue; } @@ -278,20 +275,13 @@ PH7_PRIVATE sxi32 PH7_ClassInherit(ph7_vm *pVm, ph7_class *pSub, ph7_class *pBas 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_VmThrowError(&(*pVm), PH7_CTX_ERR, "Cannot overwrite final method '%z:%z()' inside child class '%z'", &pBase->sName, pName, &pSub->sName); - if(rc == SXERR_ABORT) { - return SXERR_ABORT; - } + PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Cannot overwrite final method '%z:%z()' inside child class '%z'", &pBase->sName, pName, &pSub->sName); } continue; } else { if(pMeth->iFlags & PH7_CLASS_ATTR_VIRTUAL) { /* Virtual method must be defined in the child class */ - rc = PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Virtual method '%z:%z()' must be defined inside child class '%z'", &pBase->sName, pName, &pSub->sName); - if(rc == SXERR_ABORT) { - return SXERR_ABORT; - } - continue; + 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 */ @@ -404,11 +394,7 @@ PH7_PRIVATE sxi32 PH7_ClassImplement(ph7_vm *pVm, ph7_class *pMain, ph7_class *p if((pEntry = SyHashGet(&pMain->hMethod, (const void *)pName->zString, pName->nByte)) != 0) { continue; } else { - rc = PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Method '%z:%z()' must be defined inside class '%z'", &pInterface->sName, pName, &pMain->sName); - if(rc == SXERR_ABORT) { - return SXERR_ABORT; - } - continue; + PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Method '%z:%z()' must be defined inside class '%z'", &pInterface->sName, pName, &pMain->sName); } } /* Install in the interface container */ @@ -813,7 +799,6 @@ PH7_PRIVATE sxi32 PH7_ClassInstanceCmp(ph7_class_instance *pLeft, ph7_class_inst if(iNest > 31) { /* Nesting limit reached */ PH7_VmThrowError(pLeft->pVm, PH7_CTX_ERR, "Nesting limit reached, probably infinite recursion"); - return 1; } /* Comparison is performed only if the objects are instance of the same class */ if(pLeft->pClass != pRight->pClass) {