Browse Source

Allow non-static methods inside static (final virtual) classes to be called statically.

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

+ 1
- 1
engine/vm.c View File

@ -4333,7 +4333,7 @@ static sxi32 VmByteCodeExec(
VmPopOperand(&pTos, 1);
}
PH7_MemObjRelease(pTos);
} else if((pMeth->iFlags & PH7_CLASS_ATTR_STATIC) == 0) {
} 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()'",
&pClass->sName, &sName);
} else if(!VmClassMemberAccess(&(*pVm), pClass, pMeth->iProtection)) {

Loading…
Cancel
Save