Fix variable declaration in loops.
Some checks reported errors
The build has failed.

This commit is contained in:
2019-04-11 13:28:47 +02:00
parent ee0d189f0a
commit a8a1a2cd51
3 changed files with 14 additions and 6 deletions

View File

@@ -2402,10 +2402,11 @@ static sxi32 VmByteCodeExec(
break;
}
/*
* LOAD: * P2 P3
* LOAD: P1 P2 P3
*
* Load a variable where it's name is taken from the top of the stack or
* from the P3 operand. If P2 is set, it will create a new variable.
* If P1 is set, it will allow variable redeclaration.
*/
case PH7_OP_LOAD: {
ph7_value *pObj;
@@ -2430,7 +2431,7 @@ static sxi32 VmByteCodeExec(
/* Extract the requested memory object */
pObj = VmExtractMemObj(&(*pVm), &sName, pInstr->p3 ? FALSE : TRUE, FALSE);
if(pInstr->iP2) {
if(pObj) {
if(pObj && pInstr->iP1) {
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR,
"Redeclaration of $%z variable", &sName);
}