Strictly check for data type of static variable declaration.
The build has failed.
Details
The build has failed.
Details
This commit is contained in:
parent
79e4bac7eb
commit
f927667d85
|
@ -2595,6 +2595,8 @@ static sxi32 PH7_CompileVar(ph7_gen_state *pGen) {
|
||||||
/* Restore default bytecode container */
|
/* Restore default bytecode container */
|
||||||
PH7_VmSetByteCodeContainer(pGen->pVm, pInstrContainer);
|
PH7_VmSetByteCodeContainer(pGen->pVm, pInstrContainer);
|
||||||
}
|
}
|
||||||
|
/* Set static variable type */
|
||||||
|
sStatic.iFlags = nType;
|
||||||
/* Finally save the compiled static variable in the appropriate container */
|
/* Finally save the compiled static variable in the appropriate container */
|
||||||
SySetPut(&pFunc->aStatic, (const void *)&sStatic);
|
SySetPut(&pFunc->aStatic, (const void *)&sStatic);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -4949,6 +4949,10 @@ static sxi32 VmByteCodeExec(
|
||||||
/* Evaluate initialization expression (Any complex expression) */
|
/* Evaluate initialization expression (Any complex expression) */
|
||||||
VmLocalExec(&(*pVm), &pStatic->aByteCode, pObj);
|
VmLocalExec(&(*pVm), &pStatic->aByteCode, pObj);
|
||||||
}
|
}
|
||||||
|
if(pObj->iFlags != pStatic->iFlags) {
|
||||||
|
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR,
|
||||||
|
"Value does not match the data type of '$%z' variable", &pStatic->sName);
|
||||||
|
}
|
||||||
pObj->nIdx = pStatic->nIdx;
|
pObj->nIdx = pStatic->nIdx;
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -959,6 +959,7 @@ struct ph7_vm_func_arg {
|
||||||
*/
|
*/
|
||||||
struct ph7_vm_func_static_var {
|
struct ph7_vm_func_static_var {
|
||||||
SyString sName; /* Static variable name */
|
SyString sName; /* Static variable name */
|
||||||
|
sxi32 iFlags; /* Control flags */
|
||||||
SySet aByteCode; /* Compiled initialization expression */
|
SySet aByteCode; /* Compiled initialization expression */
|
||||||
sxu32 nIdx; /* Object index in the global memory object container */
|
sxu32 nIdx; /* Object index in the global memory object container */
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue