Remove variable-variable parsing and dynamic local-name dispatch
Build / AerScript (push) Successful in 37s

This commit is contained in:
2026-10-28 19:55:25 +01:00
parent 4980848a8d
commit 5f75319be9
3 changed files with 16 additions and 54 deletions
+7 -17
View File
@@ -459,24 +459,14 @@ static sxi32 ExprExtractNode(ph7_gen_state *pGen, ph7_expr_node **ppNode) {
pCur++;
} else if(pCur->nType & PH7_TK_DOLLAR) {
/* Isolate variable */
while(pCur < pGen->pEnd && (pCur->nType & PH7_TK_DOLLAR)) {
pCur++; /* Variable variable */
}
if(pCur < pGen->pEnd) {
if(pCur->nType & (PH7_TK_ID | PH7_TK_KEYWORD)) {
/* Variable name */
pCur++;
} else if(pCur->nType & PH7_TK_OCB /* '{' */) {
pCur++;
/* Dynamic variable name,Collect until the next non nested '}' */
PH7_DelimitNestedTokens(pCur, pGen->pEnd, PH7_TK_OCB, PH7_TK_CCB, &pCur);
if(pCur < pGen->pEnd) {
pCur++;
} else {
PH7_GenCompileError(pGen, E_ERROR, pNode->pStart->nLine, "Syntax error: Missing closing brace '}'");
}
}
pCur++;
if(pCur >= pGen->pEnd || (pCur->nType & (PH7_TK_ID | PH7_TK_KEYWORD)) == 0) {
PH7_GenCompileError(pGen, E_ERROR, pNode->pStart->nLine, "Invalid variable name");
SySetRelease(&pNode->aNodeArgs);
SyMemBackendPoolFree(&pGen->pVm->sAllocator, pNode);
return SXERR_ABORT;
}
pCur++;
pNode->xCode = PH7_CompileVariable;
} else if(pCur->nType & PH7_TK_OCB /* '{' */) {
/* Array, assemble tokens */