Get rid of variable variables. AerScript does not support it.
The build was successful.
Details
The build was successful.
Details
This commit is contained in:
parent
aa64a5eeb2
commit
555234e381
|
@ -981,15 +981,11 @@ PH7_PRIVATE sxi32 PH7_CompileLangConstruct(ph7_gen_state *pGen, sxi32 iCompileFl
|
|||
*/
|
||||
PH7_PRIVATE sxi32 PH7_CompileVariable(ph7_gen_state *pGen, sxi32 iCompileFlag) {
|
||||
sxu32 nLine = pGen->pIn->nLine;
|
||||
sxi32 iVv;
|
||||
void *p3;
|
||||
sxi32 rc;
|
||||
iVv = -1; /* Variable variable counter */
|
||||
while(pGen->pIn < pGen->pEnd && (pGen->pIn->nType & PH7_TK_DOLLAR)) {
|
||||
/* Jump the dollar sign */
|
||||
pGen->pIn++;
|
||||
iVv++;
|
||||
}
|
||||
if(pGen->pIn >= pGen->pEnd || (pGen->pIn->nType & (PH7_TK_ID | PH7_TK_KEYWORD | PH7_TK_OCB/*'{'*/)) == 0) {
|
||||
if(pGen->pIn >= pGen->pEnd || (pGen->pIn->nType & (PH7_TK_ID | PH7_TK_KEYWORD)) == 0) {
|
||||
/* Invalid variable name */
|
||||
rc = PH7_GenCompileError(pGen, E_ERROR, nLine, "Invalid variable name");
|
||||
if(rc == SXERR_ABORT) {
|
||||
|
@ -999,24 +995,6 @@ PH7_PRIVATE sxi32 PH7_CompileVariable(ph7_gen_state *pGen, sxi32 iCompileFlag) {
|
|||
return SXRET_OK;
|
||||
}
|
||||
p3 = 0;
|
||||
if(pGen->pIn->nType & PH7_TK_OCB/*'{'*/) {
|
||||
/* Dynamic variable creation */
|
||||
pGen->pIn++; /* Jump the open curly */
|
||||
pGen->pEnd--; /* Ignore the trailing curly */
|
||||
if(pGen->pIn >= pGen->pEnd) {
|
||||
/* Empty expression */
|
||||
PH7_GenCompileError(&(*pGen), E_ERROR, nLine, "Invalid variable name");
|
||||
return SXRET_OK;
|
||||
}
|
||||
/* Compile the expression holding the variable name */
|
||||
rc = PH7_CompileExpr(&(*pGen), 0, 0);
|
||||
if(rc == SXERR_ABORT) {
|
||||
return SXERR_ABORT;
|
||||
} else if(rc == SXERR_EMPTY) {
|
||||
PH7_GenCompileError(&(*pGen), E_ERROR, nLine, "Missing variable name");
|
||||
return SXRET_OK;
|
||||
}
|
||||
} else {
|
||||
SyHashEntry *pEntry;
|
||||
SyString *pName;
|
||||
char *zName = 0;
|
||||
|
@ -1039,13 +1017,8 @@ PH7_PRIVATE sxi32 PH7_CompileVariable(ph7_gen_state *pGen, sxi32 iCompileFlag) {
|
|||
zName = (char *)pEntry->pUserData;
|
||||
}
|
||||
p3 = (void *)zName;
|
||||
}
|
||||
/* Emit the load instruction */
|
||||
PH7_VmEmitInstr(pGen->pVm, 0, PH7_OP_LOAD, 0, 0, p3, 0);
|
||||
while(iVv > 0) {
|
||||
PH7_VmEmitInstr(pGen->pVm, 0, PH7_OP_LOAD, 0, 0, 0, 0);
|
||||
iVv--;
|
||||
}
|
||||
/* Node successfully compiled */
|
||||
return SXRET_OK;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue