diff src/structs.h @ 19912:d4fa9db88d16 v8.2.0512

patch 8.2.0512: Vim9: no optional arguments in func type Commit: https://github.com/vim/vim/commit/5deeb3f1f9db4eabd36e99cbf857fe376eb37e10 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Apr 5 17:08:17 2020 +0200 patch 8.2.0512: Vim9: no optional arguments in func type Problem: Vim9: no optional arguments in func type. Solution: Check for question mark after type. Find function reference without function().
author Bram Moolenaar <Bram@vim.org>
date Sun, 05 Apr 2020 17:15:25 +0200
parents bd4f91762d0f
children 1f42c49c3d29
line wrap: on
line diff
--- a/src/structs.h
+++ b/src/structs.h
@@ -1341,10 +1341,11 @@ typedef enum
 typedef struct type_S type_T;
 struct type_S {
     vartype_T	    tt_type;
-    short	    tt_argcount;    // for func, partial, -1 for unknown
-    short	    tt_flags;	    // TTFLAG_ values
+    char	    tt_argcount;    // for func, -1 for unknown
+    char	    tt_min_argcount; // number of non-optional arguments
+    char	    tt_flags;	    // TTFLAG_ values
     type_T	    *tt_member;	    // for list, dict, func return type
-    type_T	    **tt_args;	    // func arguments, allocated
+    type_T	    **tt_args;	    // func argument types, allocated
 };
 
 #define TTFLAG_VARARGS	1	    // func args ends with "..."
@@ -1520,7 +1521,7 @@ typedef struct
     int		uf_calls;	// nr of active calls
     int		uf_cleared;	// func_clear() was already called
     int		uf_dfunc_idx;	// >= 0 for :def function only
-    garray_T	uf_args;	// arguments
+    garray_T	uf_args;	// arguments, including optional arguments
     garray_T	uf_def_args;	// default argument expressions
 
     // for :def (for :function uf_ret_type is NULL)
@@ -1531,6 +1532,7 @@ typedef struct
 				// uf_def_args; length: uf_def_args.ga_len + 1
     char_u	*uf_va_name;	// name from "...name" or NULL
     type_T	*uf_va_type;	// type from "...name: type" or NULL
+    type_T	*uf_func_type;	// type of the function, &t_func_any if unknown
 
     garray_T	uf_lines;	// function lines
 # ifdef FEAT_PROFILE