summaryrefslogtreecommitdiffstats
path: root/src/vim9compile.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-03-31 23:13:10 +0200
committerBram Moolenaar <Bram@vim.org>2020-03-31 23:13:10 +0200
commitbd5da371aafe5a2207065643502f4d1ff6b286c7 (patch)
treea76f8259b8caaf9d223063d307da28a5ea049c15 /src/vim9compile.c
parent9be61bbb170ed3df0e408c8ac12516e772dc0b75 (diff)
patch 8.2.0487: Vim9: compiling not sufficiently testedv8.2.0487
Problem: Vim9: compiling not sufficiently tested. Solution: Add more tests. Fix bug with PCALL.
Diffstat (limited to 'src/vim9compile.c')
-rw-r--r--src/vim9compile.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 9fdfdb3b64..c7f5032644 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -1196,6 +1196,11 @@ generate_PCALL(cctx_T *cctx, int argcount, int at_top)
// drop the funcref/partial, get back the return value
((type_T **)stack->ga_data)[stack->ga_len - 1] = &t_any;
+ // If partial is above the arguments it must be cleared and replaced with
+ // the return value.
+ if (at_top && generate_instr(cctx, ISN_PCALL_END) == NULL)
+ return FAIL;
+
return OK;
}
@@ -5200,7 +5205,7 @@ compile_def_function(ufunc_T *ufunc, int set_return_type)
p = (*ea.cmd == '&' || *ea.cmd == '$' || *ea.cmd == '@')
? ea.cmd + 1 : ea.cmd;
p = to_name_end(p, TRUE);
- if ((p > ea.cmd && *p != NUL) || *p == '(')
+ if (p > ea.cmd && *p != NUL)
{
int oplen;
int heredoc;
@@ -5538,6 +5543,7 @@ delete_instr(isn_T *isn)
case ISN_OPFLOAT:
case ISN_OPANY:
case ISN_PCALL:
+ case ISN_PCALL_END:
case ISN_PUSHF:
case ISN_PUSHNR:
case ISN_PUSHBOOL: