Do not allow to initialize an implicitly-typed variable with an array initializer.
Todas as verificações foram bem sucedidas
The build was successful.
Todas as verificações foram bem sucedidas
The build was successful.
Esse commit está contido em:
pai
78c416c6b8
commit
0327c3130f
@ -2454,6 +2454,10 @@ static sxi32 PH7_CompileVar(ph7_gen_state *pGen) {
|
|||||||
if(pGen->pIn < pGen->pEnd && (pGen->pIn->nType & PH7_TK_EQUAL)) {
|
if(pGen->pIn < pGen->pEnd && (pGen->pIn->nType & PH7_TK_EQUAL)) {
|
||||||
SySet *pInstrContainer;
|
SySet *pInstrContainer;
|
||||||
pGen->pIn++; /* Jump the equal '=' sign */
|
pGen->pIn++; /* Jump the equal '=' sign */
|
||||||
|
if(nType == MEMOBJ_NULL && pGen->pIn->nType & PH7_TK_OCB) {
|
||||||
|
PH7_GenCompileError(&(*pGen), E_ERROR, pGen->pIn->nLine,
|
||||||
|
"Cannot initialize an implicitly-typed variable '$%z' with an array initializer", pName);
|
||||||
|
}
|
||||||
/* Swap bytecode container */
|
/* Swap bytecode container */
|
||||||
pInstrContainer = PH7_VmGetByteCodeContainer(pGen->pVm);
|
pInstrContainer = PH7_VmGetByteCodeContainer(pGen->pVm);
|
||||||
PH7_VmSetByteCodeContainer(pGen->pVm, &sStatic.aByteCode);
|
PH7_VmSetByteCodeContainer(pGen->pVm, &sStatic.aByteCode);
|
||||||
@ -2485,6 +2489,10 @@ static sxi32 PH7_CompileVar(ph7_gen_state *pGen) {
|
|||||||
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_POP, 1, 0, 0, 0);
|
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_POP, 1, 0, 0, 0);
|
||||||
/* Check if we have an expression to compile */
|
/* Check if we have an expression to compile */
|
||||||
if(pGen->pIn < pGen->pEnd && (pGen->pIn[2].nType & PH7_TK_EQUAL)) {
|
if(pGen->pIn < pGen->pEnd && (pGen->pIn[2].nType & PH7_TK_EQUAL)) {
|
||||||
|
if(nType == MEMOBJ_NULL && pGen->pIn[3].nType & PH7_TK_OCB) {
|
||||||
|
PH7_GenCompileError(&(*pGen), E_ERROR, pGen->pIn->nLine,
|
||||||
|
"Cannot initialize an implicitly-typed variable '$%z' with an array initializer", pName);
|
||||||
|
}
|
||||||
/* Compile the expression */
|
/* Compile the expression */
|
||||||
rc = PH7_CompileExpr(&(*pGen), EXPR_FLAG_COMMA_STATEMENT, 0);
|
rc = PH7_CompileExpr(&(*pGen), EXPR_FLAG_COMMA_STATEMENT, 0);
|
||||||
if(rc == SXERR_ABORT) {
|
if(rc == SXERR_ABORT) {
|
||||||
|
Carregando…
x
Referência em uma nova issue
Block a user