Give argument lists their own link, not each argument's .right

An identifier's subscript list, a unary's operand and a binary's right-hand
side all lived in the same field the argument chain used, so ABS(-9),
MOD(A#, B# + 12) and any array reference in a parameter list were counted as
extra arguments and refused. Subscript lists move to .expr and arguments now
chain through a dedicated .next.

This is the third time the same collision was fixed; the first two moved it
along rather than removing it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Andrew Kesterson <andrew@aklabs.net>
This commit is contained in:
2026-07-31 11:58:15 -04:00
parent e7ef48f1ca
commit 4e98dba423
14 changed files with 133 additions and 55 deletions

View File

@@ -329,10 +329,10 @@ static akerr_ErrorContext *collect_subscripts(akbasic_Environment *obj, akbasic_
akbasic_Value *tval = NULL;
*count = 0;
if ( lval->right != NULL &&
lval->right->leaftype == AKBASIC_LEAF_ARGUMENTLIST &&
lval->right->operator_ == AKBASIC_TOK_ARRAY_SUBSCRIPT ) {
for ( expr = lval->right->right; expr != NULL; expr = expr->right ) {
if ( lval->expr != NULL &&
lval->expr->leaftype == AKBASIC_LEAF_ARGUMENTLIST &&
lval->expr->operator_ == AKBASIC_TOK_ARRAY_SUBSCRIPT ) {
for ( expr = lval->expr->right; expr != NULL; expr = expr->next ) {
FAIL_ZERO_RETURN(errctx, (*count < AKBASIC_MAX_ARRAY_DEPTH), AKBASIC_ERR_BOUNDS,
"More than %d array subscripts", AKBASIC_MAX_ARRAY_DEPTH);
PASS(errctx, akbasic_runtime_evaluate(obj->runtime, expr, &tval));