diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2022-02-09 07:39:36 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2022-02-09 07:39:36 +0200 |
commit | 8785cde2cb5e54790cc395cab1a35b1a685ee8c0 (patch) | |
tree | 2245cdacf79ddba6cec5ddd220b1e907a85c93d4 /interpret.h | |
parent | 18213a779d239baf5e24ba52d77ba920f314ab7e (diff) | |
parent | 0b94b68387b85310b7104bb669d7b698e92888d2 (diff) | |
download | egawk-8785cde2cb5e54790cc395cab1a35b1a685ee8c0.tar.gz egawk-8785cde2cb5e54790cc395cab1a35b1a685ee8c0.tar.bz2 egawk-8785cde2cb5e54790cc395cab1a35b1a685ee8c0.zip |
Merge branch 'gawk-5.1-stable'
Diffstat (limited to 'interpret.h')
-rw-r--r-- | interpret.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/interpret.h b/interpret.h index df70bd09..3d9ba572 100644 --- a/interpret.h +++ b/interpret.h @@ -67,6 +67,7 @@ r_interpret(INSTRUCTION *code) Regexp *rp; NODE *set_array = NULL; /* array with a post-assignment routine */ NODE *set_idx = NULL; /* the index of the array element */ + bool in_indirect_call = false; /* array subscript */ @@ -1059,6 +1060,14 @@ arrayfor: DEREF(t1); } free_api_string_copies(); + + if (in_indirect_call) { + // pop function name off the stack + NODE *fname = POP(); + DEREF(fname); + in_indirect_call = false; + } + PUSH(r); } break; @@ -1132,6 +1141,7 @@ match_re: NODE *f = NULL; int arg_count; char save; + NODE *function_name; arg_count = (pc + 1)->expr_count; t1 = PEEK(arg_count); /* indirect var */ @@ -1174,6 +1184,12 @@ match_re: r = the_func(arg_count); str_restore(t1, save); + // Normally, setup_frame() handles getting rid of the + // function name. Since we have called the builtin directly, + // we have to manually do this here. + function_name = POP(); + DEREF(function_name); + PUSH(r); break; } else if (f->type != Node_func) { @@ -1195,6 +1211,7 @@ match_re: npc[1] = pc[1]; npc[1].func_name = fname; /* name of the builtin */ npc[1].c_function = bc->c_function; + in_indirect_call = true; ni = npc; JUMPTO(ni); } else |