summaryrefslogtreecommitdiff
path: root/src/userfunc.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-03-01 23:32:25 +0100
committerBram Moolenaar <Bram@vim.org>2020-03-01 23:32:25 +0100
commit61a6d4e48b4778bdbc741af8ac59519b70f65db8 (patch)
treeffa03817059df8f22ed6e4285e788db657e1c185 /src/userfunc.c
parent815eb83b09914ecff32193913a373cb385868421 (diff)
downloadvim-git-61a6d4e48b4778bdbc741af8ac59519b70f65db8.tar.gz
patch 8.2.0346: Vim9: finding common list type not testedv8.2.0346
Problem: Vim9: finding common list type not tested. Solution: Add more tests. Fix listing function. Fix overwriting type.
Diffstat (limited to 'src/userfunc.c')
-rw-r--r--src/userfunc.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/userfunc.c b/src/userfunc.c
index 9ff78c29b..c6c6cec3c 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -1902,7 +1902,7 @@ printable_func_name(ufunc_T *fp)
}
/*
- * List the head of the function: "name(arg1, arg2)".
+ * List the head of the function: "function name(arg1, arg2)".
*/
static void
list_func_head(ufunc_T *fp, int indent)
@@ -1912,7 +1912,10 @@ list_func_head(ufunc_T *fp, int indent)
msg_start();
if (indent)
msg_puts(" ");
- msg_puts("function ");
+ if (fp->uf_dfunc_idx >= 0)
+ msg_puts("def ");
+ else
+ msg_puts("function ");
msg_puts((char *)printable_func_name(fp));
msg_putchar('(');
for (j = 0; j < fp->uf_args.ga_len; ++j)
@@ -1957,7 +1960,19 @@ list_func_head(ufunc_T *fp, int indent)
}
}
msg_putchar(')');
- if (fp->uf_flags & FC_ABORT)
+
+ if (fp->uf_dfunc_idx >= 0)
+ {
+ if (fp->uf_ret_type != &t_void)
+ {
+ char *tofree;
+
+ msg_puts(": ");
+ msg_puts(type_name(fp->uf_ret_type, &tofree));
+ vim_free(tofree);
+ }
+ }
+ else if (fp->uf_flags & FC_ABORT)
msg_puts(" abort");
if (fp->uf_flags & FC_RANGE)
msg_puts(" range");