comparison 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
comparison
equal deleted inserted replaced
19578:0ed88fd84485 19579:aae19dd172c0
1900 { 1900 {
1901 return fp->uf_name_exp != NULL ? fp->uf_name_exp : fp->uf_name; 1901 return fp->uf_name_exp != NULL ? fp->uf_name_exp : fp->uf_name;
1902 } 1902 }
1903 1903
1904 /* 1904 /*
1905 * List the head of the function: "name(arg1, arg2)". 1905 * List the head of the function: "function name(arg1, arg2)".
1906 */ 1906 */
1907 static void 1907 static void
1908 list_func_head(ufunc_T *fp, int indent) 1908 list_func_head(ufunc_T *fp, int indent)
1909 { 1909 {
1910 int j; 1910 int j;
1911 1911
1912 msg_start(); 1912 msg_start();
1913 if (indent) 1913 if (indent)
1914 msg_puts(" "); 1914 msg_puts(" ");
1915 msg_puts("function "); 1915 if (fp->uf_dfunc_idx >= 0)
1916 msg_puts("def ");
1917 else
1918 msg_puts("function ");
1916 msg_puts((char *)printable_func_name(fp)); 1919 msg_puts((char *)printable_func_name(fp));
1917 msg_putchar('('); 1920 msg_putchar('(');
1918 for (j = 0; j < fp->uf_args.ga_len; ++j) 1921 for (j = 0; j < fp->uf_args.ga_len; ++j)
1919 { 1922 {
1920 if (j) 1923 if (j)
1955 msg_puts(type_name(fp->uf_va_type, &tofree)); 1958 msg_puts(type_name(fp->uf_va_type, &tofree));
1956 vim_free(tofree); 1959 vim_free(tofree);
1957 } 1960 }
1958 } 1961 }
1959 msg_putchar(')'); 1962 msg_putchar(')');
1960 if (fp->uf_flags & FC_ABORT) 1963
1964 if (fp->uf_dfunc_idx >= 0)
1965 {
1966 if (fp->uf_ret_type != &t_void)
1967 {
1968 char *tofree;
1969
1970 msg_puts(": ");
1971 msg_puts(type_name(fp->uf_ret_type, &tofree));
1972 vim_free(tofree);
1973 }
1974 }
1975 else if (fp->uf_flags & FC_ABORT)
1961 msg_puts(" abort"); 1976 msg_puts(" abort");
1962 if (fp->uf_flags & FC_RANGE) 1977 if (fp->uf_flags & FC_RANGE)
1963 msg_puts(" range"); 1978 msg_puts(" range");
1964 if (fp->uf_flags & FC_DICT) 1979 if (fp->uf_flags & FC_DICT)
1965 msg_puts(" dict"); 1980 msg_puts(" dict");