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().
diff --git a/src/structs.h b/src/structs.h
index efc74da..4a51281 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -1341,10 +1341,11 @@
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 @@
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 @@
// 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