This commit is contained in:
parent
a013cee2d1
commit
140bd35f93
@ -3359,7 +3359,7 @@ loop:
|
|||||||
}
|
}
|
||||||
pGen->pIn++; /* Jump the equal sign */
|
pGen->pIn++; /* Jump the equal sign */
|
||||||
/* Allocate a new class attribute */
|
/* Allocate a new class attribute */
|
||||||
pCons = PH7_NewClassAttr(pGen->pVm, pName, nLine, iProtection, iFlags);
|
pCons = PH7_NewClassAttr(pGen->pVm, pName, nLine, iProtection, iFlags, 0);
|
||||||
if(pCons == 0) {
|
if(pCons == 0) {
|
||||||
PH7_GenCompileError(pGen, E_ERROR, nLine, "Fatal, PH7 is running out of memory");
|
PH7_GenCompileError(pGen, E_ERROR, nLine, "Fatal, PH7 is running out of memory");
|
||||||
return SXERR_ABORT;
|
return SXERR_ABORT;
|
||||||
@ -3438,7 +3438,7 @@ Synchronize:
|
|||||||
* Refer to the official documentation for more information on the powerful extension
|
* Refer to the official documentation for more information on the powerful extension
|
||||||
* introduced by the PH7 engine to the OO subsystem.
|
* introduced by the PH7 engine to the OO subsystem.
|
||||||
*/
|
*/
|
||||||
static sxi32 PH7_GenStateCompileClassAttr(ph7_gen_state *pGen, sxi32 iProtection, sxi32 iFlags, ph7_class *pClass) {
|
static sxi32 PH7_GenStateCompileClassAttr(ph7_gen_state *pGen, sxi32 iProtection, sxi32 iFlags, sxu32 nType, ph7_class *pClass) {
|
||||||
sxu32 nLine = pGen->pIn->nLine;
|
sxu32 nLine = pGen->pIn->nLine;
|
||||||
ph7_class_attr *pAttr;
|
ph7_class_attr *pAttr;
|
||||||
SyString *pName;
|
SyString *pName;
|
||||||
@ -3470,7 +3470,7 @@ loop:
|
|||||||
goto Synchronize;
|
goto Synchronize;
|
||||||
}
|
}
|
||||||
/* Allocate a new class attribute */
|
/* Allocate a new class attribute */
|
||||||
pAttr = PH7_NewClassAttr(pGen->pVm, pName, nLine, iProtection, iFlags);
|
pAttr = PH7_NewClassAttr(pGen->pVm, pName, nLine, iProtection, iFlags, nType);
|
||||||
if(pAttr == 0) {
|
if(pAttr == 0) {
|
||||||
PH7_GenCompileError(pGen, E_ERROR, nLine, "Fatal, PH7 engine is running out of memory");
|
PH7_GenCompileError(pGen, E_ERROR, nLine, "Fatal, PH7 engine is running out of memory");
|
||||||
return SXERR_ABORT;
|
return SXERR_ABORT;
|
||||||
@ -4286,7 +4286,7 @@ static sxi32 PH7_GenStateCompileClass(ph7_gen_state *pGen, sxi32 iFlags) {
|
|||||||
}
|
}
|
||||||
if(pGen->pIn->nType & PH7_TK_DOLLAR/*'$'*/) {
|
if(pGen->pIn->nType & PH7_TK_DOLLAR/*'$'*/) {
|
||||||
/* Attribute declaration */
|
/* Attribute declaration */
|
||||||
rc = PH7_GenStateCompileClassAttr(&(*pGen), iProtection, iAttrflags, pClass);
|
rc = PH7_GenStateCompileClassAttr(&(*pGen), iProtection, iAttrflags, nType, pClass);
|
||||||
} else {
|
} else {
|
||||||
/* Process method declaration */
|
/* Process method declaration */
|
||||||
rc = PH7_GenStateCompileClassMethod(&(*pGen), nType, iProtection, iAttrflags, TRUE, pClass);
|
rc = PH7_GenStateCompileClassMethod(&(*pGen), nType, iProtection, iAttrflags, TRUE, pClass);
|
||||||
|
@ -75,7 +75,7 @@ PH7_PRIVATE ph7_class *PH7_NewRawClass(ph7_vm *pVm, const SyString *pName) {
|
|||||||
* Allocate and initialize a new class attribute.
|
* Allocate and initialize a new class attribute.
|
||||||
* Return a pointer to the class attribute on success. NULL otherwise.
|
* Return a pointer to the class attribute on success. NULL otherwise.
|
||||||
*/
|
*/
|
||||||
PH7_PRIVATE ph7_class_attr *PH7_NewClassAttr(ph7_vm *pVm, const SyString *pName, sxu32 nLine, sxi32 iProtection, sxi32 iFlags) {
|
PH7_PRIVATE ph7_class_attr *PH7_NewClassAttr(ph7_vm *pVm, const SyString *pName, sxu32 nLine, sxi32 iProtection, sxi32 iFlags, sxu32 nType) {
|
||||||
ph7_class_attr *pAttr;
|
ph7_class_attr *pAttr;
|
||||||
char *zName;
|
char *zName;
|
||||||
pAttr = (ph7_class_attr *)SyMemBackendPoolAlloc(&pVm->sAllocator, sizeof(ph7_class_attr));
|
pAttr = (ph7_class_attr *)SyMemBackendPoolAlloc(&pVm->sAllocator, sizeof(ph7_class_attr));
|
||||||
@ -96,6 +96,7 @@ PH7_PRIVATE ph7_class_attr *PH7_NewClassAttr(ph7_vm *pVm, const SyString *pName,
|
|||||||
pAttr->iProtection = iProtection;
|
pAttr->iProtection = iProtection;
|
||||||
pAttr->nIdx = SXU32_HIGH;
|
pAttr->nIdx = SXU32_HIGH;
|
||||||
pAttr->iFlags = iFlags;
|
pAttr->iFlags = iFlags;
|
||||||
|
pAttr->nType = nType;
|
||||||
pAttr->nLine = nLine;
|
pAttr->nLine = nLine;
|
||||||
return pAttr;
|
return pAttr;
|
||||||
}
|
}
|
||||||
|
@ -695,6 +695,7 @@ PH7_PRIVATE sxi32 PH7_VmCreateClassInstanceFrame(
|
|||||||
SyMemBackendPoolFree(&pVm->sAllocator, pVmAttr);
|
SyMemBackendPoolFree(&pVm->sAllocator, pVmAttr);
|
||||||
return SXERR_MEM;
|
return SXERR_MEM;
|
||||||
}
|
}
|
||||||
|
MemObjSetType(pMemObj, pAttr->nType);
|
||||||
pVmAttr->nIdx = pMemObj->nIdx;
|
pVmAttr->nIdx = pMemObj->nIdx;
|
||||||
if(SySetUsed(&pAttr->aByteCode) > 0) {
|
if(SySetUsed(&pAttr->aByteCode) > 0) {
|
||||||
/* Initialize attribute default value (any complex expression) */
|
/* Initialize attribute default value (any complex expression) */
|
||||||
|
@ -128,7 +128,7 @@ static sxi32 PH7_GenStateCompileFunc(ph7_gen_state *pGen, SyString *pName, sxi32
|
|||||||
static sxi32 PH7_CompileFunction(ph7_gen_state *pGen);
|
static sxi32 PH7_CompileFunction(ph7_gen_state *pGen);
|
||||||
static sxi32 PH7_GetProtectionLevel(sxi32 nKeyword);
|
static sxi32 PH7_GetProtectionLevel(sxi32 nKeyword);
|
||||||
static sxi32 PH7_GenStateCompileClassConstant(ph7_gen_state *pGen, sxi32 iProtection, sxi32 iFlags, ph7_class *pClass);
|
static sxi32 PH7_GenStateCompileClassConstant(ph7_gen_state *pGen, sxi32 iProtection, sxi32 iFlags, ph7_class *pClass);
|
||||||
static sxi32 PH7_GenStateCompileClassAttr(ph7_gen_state *pGen, sxi32 iProtection, sxi32 iFlags, ph7_class *pClass);
|
static sxi32 PH7_GenStateCompileClassAttr(ph7_gen_state *pGen, sxi32 iProtection, sxi32 iFlags, sxu32 nType, ph7_class *pClass);
|
||||||
static sxi32 PH7_GenStateCompileClassMethod(ph7_gen_state *pGen, sxu32 nType, sxi32 iProtection, sxi32 iFlags, int doBody, ph7_class *pClass);
|
static sxi32 PH7_GenStateCompileClassMethod(ph7_gen_state *pGen, sxu32 nType, sxi32 iProtection, sxi32 iFlags, int doBody, ph7_class *pClass);
|
||||||
static sxi32 PH7_CompileClassInterface(ph7_gen_state *pGen);
|
static sxi32 PH7_CompileClassInterface(ph7_gen_state *pGen);
|
||||||
static sxi32 PH7_GenStateCompileClass(ph7_gen_state *pGen, sxi32 iFlags);
|
static sxi32 PH7_GenStateCompileClass(ph7_gen_state *pGen, sxi32 iFlags);
|
||||||
|
@ -1075,6 +1075,7 @@ struct ph7_class_attr {
|
|||||||
sxi32 iFlags; /* Attribute configuration [i.e: static, variable, constant, etc.] */
|
sxi32 iFlags; /* Attribute configuration [i.e: static, variable, constant, etc.] */
|
||||||
sxi32 iProtection; /* Protection level [i.e: public, private, protected] */
|
sxi32 iProtection; /* Protection level [i.e: public, private, protected] */
|
||||||
SySet aByteCode; /* Compiled attribute body */
|
SySet aByteCode; /* Compiled attribute body */
|
||||||
|
sxu32 nType; /* Class attribute data type */
|
||||||
sxu32 nIdx; /* Attribute index */
|
sxu32 nIdx; /* Attribute index */
|
||||||
sxu32 nLine; /* Line number on which this attribute was defined */
|
sxu32 nLine; /* Line number on which this attribute was defined */
|
||||||
};
|
};
|
||||||
@ -1763,7 +1764,7 @@ PH7_PRIVATE sxi32 PH7_ParseIniString(ph7_context *pCtx, const char *zIn, sxu32 n
|
|||||||
/* oo.c function prototypes */
|
/* oo.c function prototypes */
|
||||||
PH7_PRIVATE ph7_class_info *PH7_NewClassInfo(ph7_vm *pVm, const SyString *pName);
|
PH7_PRIVATE ph7_class_info *PH7_NewClassInfo(ph7_vm *pVm, const SyString *pName);
|
||||||
PH7_PRIVATE ph7_class *PH7_NewRawClass(ph7_vm *pVm, const SyString *pName);
|
PH7_PRIVATE ph7_class *PH7_NewRawClass(ph7_vm *pVm, const SyString *pName);
|
||||||
PH7_PRIVATE ph7_class_attr *PH7_NewClassAttr(ph7_vm *pVm, const SyString *pName, sxu32 nLine, sxi32 iProtection, sxi32 iFlags);
|
PH7_PRIVATE ph7_class_attr *PH7_NewClassAttr(ph7_vm *pVm, const SyString *pName, sxu32 nLine, sxi32 iProtection, sxi32 iFlags, sxu32 nType);
|
||||||
PH7_PRIVATE ph7_class_method *PH7_NewClassMethod(ph7_vm *pVm, ph7_class *pClass, const SyString *pName, sxu32 nLine,
|
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, sxi32 iFuncFlags);
|
||||||
PH7_PRIVATE ph7_class_method *PH7_ClassExtractMethod(ph7_class *pClass, const char *zName, sxu32 nByte);
|
PH7_PRIVATE ph7_class_method *PH7_ClassExtractMethod(ph7_class *pClass, const char *zName, sxu32 nByte);
|
||||||
|
Loading…
Reference in New Issue
Block a user