summaryrefslogtreecommitdiff
path: root/src/userfunc.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-05-22 18:31:35 +0200
committerBram Moolenaar <Bram@vim.org>2018-05-22 18:31:35 +0200
commitb4518563c73460150344a57879bf5b22cb8b1c77 (patch)
treebd32958994688a8d0116ce8961dee863c4d282c1 /src/userfunc.c
parentbdb657924d73c98b0ab28411749571e893b699a9 (diff)
downloadvim-git-b4518563c73460150344a57879bf5b22cb8b1c77.tar.gz
patch 8.1.0019: error when defining a Lambda with index of a function resultv8.1.0019
Problem: Error when defining a Lambda with index of a function result. Solution: When not evaluating an expression and skipping a function call, set the return value to VAR_UNKNOWN.
Diffstat (limited to 'src/userfunc.c')
-rw-r--r--src/userfunc.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/userfunc.c b/src/userfunc.c
index f9b0e8192..08112689d 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -1349,8 +1349,16 @@ call_func(
}
- /* execute the function if no errors detected and executing */
- if (evaluate && error == ERROR_NONE)
+ /*
+ * Execute the function if executing and no errors were detected.
+ */
+ if (!evaluate)
+ {
+ // Not evaluating, which means the return value is unknown. This
+ // matters for giving error messages.
+ rettv->v_type = VAR_UNKNOWN;
+ }
+ else if (error == ERROR_NONE)
{
char_u *rfname = fname;