Allow the array typedef constructs to be used not only when declaring a variable.
The build was successful.
Details
The build was successful.
Details
This commit is contained in:
parent
a5af1d473f
commit
dbd39be5ed
|
@ -832,8 +832,14 @@ static sxi32 ExprMakeTree(ph7_gen_state *pGen, ph7_expr_node **apNode, sxi32 nTo
|
||||||
if(iLeft < 0 || apNode[iLeft] == 0 || (apNode[iLeft]->pOp == 0 && (apNode[iLeft]->xCode != PH7_CompileVariable &&
|
if(iLeft < 0 || apNode[iLeft] == 0 || (apNode[iLeft]->pOp == 0 && (apNode[iLeft]->xCode != PH7_CompileVariable &&
|
||||||
apNode[iLeft]->xCode != PH7_CompileSimpleString && apNode[iLeft]->xCode != PH7_CompileString)) ||
|
apNode[iLeft]->xCode != PH7_CompileSimpleString && apNode[iLeft]->xCode != PH7_CompileString)) ||
|
||||||
(apNode[iLeft]->pOp && apNode[iLeft]->pOp->iPrec != 2 /* postfix */)) {
|
(apNode[iLeft]->pOp && apNode[iLeft]->pOp->iPrec != 2 /* postfix */)) {
|
||||||
/* Syntax error */
|
sxu32 nId = 0;
|
||||||
PH7_GenCompileError(pGen, E_ERROR, pNode->pStart->nLine, "Invalid array name");
|
if(apNode[iLeft]->xCode == PH7_CompileLiteral && apNode[iLeft]->pStart->nType & PH7_TK_KEYWORD) {
|
||||||
|
nId = SX_PTR_TO_INT(apNode[iLeft]->pStart->pUserData);
|
||||||
|
}
|
||||||
|
if(!nId || (nId & PH7_KEYWORD_TYPEDEF) == 0) {
|
||||||
|
/* Syntax error */
|
||||||
|
PH7_GenCompileError(pGen, E_ERROR, pNode->pStart->nLine, "Invalid array name");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* Collect index tokens */
|
/* Collect index tokens */
|
||||||
while(iArrTok < nToken) {
|
while(iArrTok < nToken) {
|
||||||
|
@ -852,6 +858,9 @@ static sxi32 ExprMakeTree(ph7_gen_state *pGen, ph7_expr_node **apNode, sxi32 nTo
|
||||||
++iArrTok;
|
++iArrTok;
|
||||||
}
|
}
|
||||||
if(iArrTok > iCur + 1) {
|
if(iArrTok > iCur + 1) {
|
||||||
|
if(apNode[iLeft]->xCode == PH7_CompileLiteral) {
|
||||||
|
PH7_GenCompileError(pGen, E_ERROR, pNode->pStart->nLine, "Array index cannot be specified in a variable declaration");
|
||||||
|
}
|
||||||
/* Recurse and process this expression */
|
/* Recurse and process this expression */
|
||||||
rc = ExprMakeTree(&(*pGen), &apNode[iCur + 1], iArrTok - iCur - 1);
|
rc = ExprMakeTree(&(*pGen), &apNode[iCur + 1], iArrTok - iCur - 1);
|
||||||
if(rc != SXRET_OK) {
|
if(rc != SXRET_OK) {
|
||||||
|
|
Loading…
Reference in New Issue