diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2012-10-03 10:23:15 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2012-10-03 10:23:15 +0200 |
commit | 3d9b832439afeb1b05c60831e0865df585dc55ac (patch) | |
tree | a0796f2b6a97ceb6c257cad516b62083aacb55da /interpret.h | |
parent | 9e2703f7ca0b35129a94465654d0e18d14048dbc (diff) | |
download | egawk-3d9b832439afeb1b05c60831e0865df585dc55ac.tar.gz egawk-3d9b832439afeb1b05c60831e0865df585dc55ac.tar.bz2 egawk-3d9b832439afeb1b05c60831e0865df585dc55ac.zip |
More SYMTAB and FUNCTAB improvements.
Diffstat (limited to 'interpret.h')
-rw-r--r-- | interpret.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/interpret.h b/interpret.h index 208155a7..5bd3e3a6 100644 --- a/interpret.h +++ b/interpret.h @@ -210,9 +210,15 @@ top: lintwarn(_("subscript of array `%s' is null string"), array_vname(t1)); } - r = *assoc_lookup(t1, t2); + /* for FUNCTAB, get the name as the element value */ + if (t1 == func_table) { + r = t2; + } else { + r = *assoc_lookup(t1, t2); + } DEREF(t2); + /* for SYMTAB, step through to the actual variable */ if (t1 == symbol_table && r->type == Node_var) r = r->var_value; @@ -536,7 +542,9 @@ mod: } DEREF(t2); - if (t1 == symbol_table && (*lhs)->type == Node_var) + if (t1 == func_table) + fatal(_("cannot assign to elements of FUNCTAB")); + else if (t1 == symbol_table && (*lhs)->type == Node_var) lhs = & ((*lhs)->var_value); unref(*lhs); @@ -884,7 +892,10 @@ match_re: arg_count = (pc + 1)->expr_count; t1 = PEEK(arg_count); /* indirect var */ - assert(t1->type == Node_val); /* @a[1](p) not allowed in grammar */ + + if (t1->type != Node_val) /* @a[1](p) not allowed in grammar */ + fatal(_("indirect function call requires a simple scalar value")); + t1 = force_string(t1); if (t1->stlen > 0) { /* retrieve function definition node */ |