Do not switch to public visibility when dealing with constructor and/or destructor, this impairs language.

This commit is contained in:
Rafal Kupiec 2018-07-13 18:14:39 +02:00
부모 d0357787db
커밋 408ccc73c2
로그인 계정: belliash
GPG 키 ID: 4E829243E0CFE6B4

8
oop.c
파일 보기

@ -117,14 +117,6 @@ PH7_PRIVATE ph7_class_method *PH7_NewClassMethod(ph7_vm *pVm, ph7_class *pClass,
SyStringDupPtr(pNamePtr, &pCurrent->sVmName); SyStringDupPtr(pNamePtr, &pCurrent->sVmName);
zName = (char *)pNamePtr->zString; zName = (char *)pNamePtr->zString;
} }
if(iProtection != PH7_CLASS_PROT_PUBLIC) {
if((pName->nByte == sizeof("__construct") - 1 && SyMemcmp(pName->zString, "__construct", sizeof("__construct") - 1) == 0)
|| (pName->nByte == sizeof("__destruct") - 1 && SyMemcmp(pName->zString, "__destruct", sizeof("__destruct") - 1) == 0)
|| SyStringCmp(pName, &pClass->sName, SyMemcmp) == 0) {
/* Switch to public visibility when dealing with constructor/destructor */
iProtection = PH7_CLASS_PROT_PUBLIC;
}
}
/* Initialize method fields */ /* Initialize method fields */
pMeth->iProtection = iProtection; pMeth->iProtection = iProtection;
pMeth->iFlags = iFlags; pMeth->iFlags = iFlags;