This commit is contained in:
+4
-8
@@ -102,7 +102,7 @@ PH7_PRIVATE ph7_class_attr *PH7_NewClassAttr(ph7_vm *pVm, ph7_class *pClass, con
|
||||
* random unique name.
|
||||
*/
|
||||
PH7_PRIVATE ph7_class_method *PH7_NewClassMethod(ph7_vm *pVm, ph7_class *pClass, const SyString *pName, sxu32 nLine,
|
||||
sxi32 iProtection, sxi32 iFlags, sxi32 iFuncFlags) {
|
||||
sxi32 iProtection, sxi32 iFlags) {
|
||||
ph7_class_method *pMeth;
|
||||
SyHashEntry *pEntry;
|
||||
SyString *pNamePtr;
|
||||
@@ -144,7 +144,7 @@ PH7_PRIVATE ph7_class_method *PH7_NewClassMethod(ph7_vm *pVm, ph7_class *pClass,
|
||||
pMeth->iFlags = iFlags;
|
||||
pMeth->nLine = nLine;
|
||||
PH7_VmInitFuncState(&(*pVm), &pMeth->sFunc, &zName[sizeof(char) * 4/*[__@*/ + SyStringLength(&pClass->sName)],
|
||||
pName->nByte, iFuncFlags | VM_FUNC_CLASS_METHOD, pClass);
|
||||
pName->nByte, VM_FUNC_CLASS_METHOD, pClass);
|
||||
return pMeth;
|
||||
}
|
||||
/*
|
||||
@@ -362,7 +362,6 @@ static sxi32 ClassValidateMethods(ph7_vm *pVm, ph7_class *pClass) {
|
||||
if((k < SySetUsed(&pMeth->sFunc.pClass->aMro) ||
|
||||
((pMeth->iFlags & pOther->iFlags) & PH7_CLASS_ATTR_VIRTUAL)) &&
|
||||
(pMeth->sFunc.nType != pOther->sFunc.nType ||
|
||||
((pMeth->sFunc.iFlags ^ pOther->sFunc.iFlags) & VM_FUNC_REF_RETURN) ||
|
||||
((pMeth->iFlags ^ pOther->iFlags) & PH7_CLASS_ATTR_STATIC))) {
|
||||
PH7_VmThrowError(pVm, PH7_CTX_ERR, "Incompatible method contract '%z::%z()' inside class '%z'", &pOther->sFunc.pClass->sName, &pOther->sFunc.sName, &pClass->sName);
|
||||
}
|
||||
@@ -386,7 +385,6 @@ static sxi32 ClassValidateMethods(ph7_vm *pVm, ph7_class *pClass) {
|
||||
/* Every requirement uses the same first concrete C3 declaration, not
|
||||
* a later implementation selected for its compatible contract. */
|
||||
if(pImpl && (pImpl->sFunc.nType != pMeth->sFunc.nType ||
|
||||
((pImpl->sFunc.iFlags ^ pMeth->sFunc.iFlags) & VM_FUNC_REF_RETURN) ||
|
||||
((pImpl->iFlags ^ pMeth->iFlags) & PH7_CLASS_ATTR_STATIC))) {
|
||||
PH7_VmThrowError(pVm, PH7_CTX_ERR, "Incompatible method contract '%z::%z()' inside class '%z'", &pMeth->sFunc.pClass->sName, &pMeth->sFunc.sName, &pClass->sName);
|
||||
}
|
||||
@@ -486,8 +484,7 @@ static sxi32 ClassValidateInterfaces(ph7_vm *pVm, ph7_class *pClass) {
|
||||
for(j = 0; j < i; j++) {
|
||||
pOther = *(ph7_class_method **)SySetAt(&sRequired, j);
|
||||
if(PH7_VmSameSignature(&pMeth->sFunc, &pOther->sFunc) &&
|
||||
(pMeth->sFunc.nType != pOther->sFunc.nType ||
|
||||
((pMeth->sFunc.iFlags ^ pOther->sFunc.iFlags) & VM_FUNC_REF_RETURN))) {
|
||||
pMeth->sFunc.nType != pOther->sFunc.nType) {
|
||||
PH7_VmThrowError(pVm, PH7_CTX_ERR, "Conflicting interface contract '%z::%z()' inside class '%z'", &pMeth->sFunc.pClass->sName, &pMeth->sFunc.sName, &pClass->sName);
|
||||
}
|
||||
}
|
||||
@@ -507,8 +504,7 @@ static sxi32 ClassValidateInterfaces(ph7_vm *pVm, ph7_class *pClass) {
|
||||
}
|
||||
if(!pImpl || (pOther->iFlags & PH7_CLASS_ATTR_VIRTUAL)) {
|
||||
if(pOther->iProtection != PH7_CLASS_PROT_PUBLIC ||
|
||||
(pOther->iFlags & PH7_CLASS_ATTR_STATIC) || pOther->sFunc.nType != pMeth->sFunc.nType ||
|
||||
((pOther->sFunc.iFlags ^ pMeth->sFunc.iFlags) & VM_FUNC_REF_RETURN)) {
|
||||
(pOther->iFlags & PH7_CLASS_ATTR_STATIC) || pOther->sFunc.nType != pMeth->sFunc.nType) {
|
||||
PH7_VmThrowError(pVm, PH7_CTX_ERR, "Incompatible interface implementation '%z::%z()' inside class '%z'", &pMeth->sFunc.pClass->sName, &pMeth->sFunc.sName, &pClass->sName);
|
||||
}
|
||||
if(!(pOther->iFlags & PH7_CLASS_ATTR_VIRTUAL)) {
|
||||
|
||||
Reference in New Issue
Block a user