Mercurial > vim
diff src/userfunc.c @ 19579:aae19dd172c0 v8.2.0346
patch 8.2.0346: Vim9: finding common list type not tested
Commit: https://github.com/vim/vim/commit/61a6d4e48b4778bdbc741af8ac59519b70f65db8
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Mar 1 23:32:25 2020 +0100
patch 8.2.0346: Vim9: finding common list type not tested
Problem: Vim9: finding common list type not tested.
Solution: Add more tests. Fix listing function. Fix overwriting type.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 01 Mar 2020 23:45:04 +0100 |
parents | 6b1a59e71f85 |
children | d64f403289db |
line wrap: on
line diff
--- 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");