Do not allow 'continue' statement to take a parameter. This is strange construction introduced in PHP.
The build was successful. Details

This commit is contained in:
Rafal Kupiec 2019-04-16 12:32:01 +02:00
parent 89f19133d5
commit 5fddbf8737
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
1 changed files with 2 additions and 14 deletions

View File

@ -1431,25 +1431,13 @@ Synchronize:
*/
static sxi32 PH7_CompileContinue(ph7_gen_state *pGen) {
GenBlock *pLoop; /* Target loop */
sxi32 iLevel; /* How many nesting loop to skip */
sxu32 nLine;
sxi32 rc;
nLine = pGen->pIn->nLine;
iLevel = 0;
/* Jump the 'continue' keyword */
pGen->pIn++;
if(pGen->pIn < pGen->pEnd && (pGen->pIn->nType & PH7_TK_NUM)) {
/* optional numeric argument which tells us how many levels
* of enclosing loops we should skip to the end of.
*/
iLevel = (sxi32)PH7_TokenValueToInt64(&pGen->pIn->sData);
if(iLevel < 2) {
iLevel = 0;
}
pGen->pIn++; /* Jump the optional numeric argument */
}
/* Point to the target loop */
pLoop = PH7_GenStateFetchBlock(pGen->pCurrent, GEN_BLOCK_LOOP, iLevel);
pLoop = PH7_GenStateFetchBlock(pGen->pCurrent, GEN_BLOCK_LOOP, 0);
if(pLoop == 0) {
/* Illegal continue */
rc = PH7_GenCompileError(pGen, E_ERROR, nLine, "A 'continue' statement may only be used within a loop or switch");
@ -1483,7 +1471,7 @@ static sxi32 PH7_CompileContinue(ph7_gen_state *pGen) {
}
if(pGen->pIn < pGen->pEnd && (pGen->pIn->nType & PH7_TK_SEMI) == 0) {
/* Not so fatal,emit a warning only */
PH7_GenCompileError(&(*pGen), E_WARNING, pGen->pIn->nLine, "Expected semi-colon ';' after 'continue' statement");
PH7_GenCompileError(&(*pGen), E_ERROR, pGen->pIn->nLine, "Expected semi-colon ';' after 'continue' statement");
}
/* Statement successfully compiled */
return SXRET_OK;