diff src/structs.h @ 16615:1a911bd57f11 v8.1.1310

patch 8.1.1310: named function arguments are never optional commit https://github.com/vim/vim/commit/42ae78cfff171fbd7412306083fe200245d7a7a6 Author: Bram Moolenaar <Bram@vim.org> Date: Thu May 9 21:08:58 2019 +0200 patch 8.1.1310: named function arguments are never optional Problem: Named function arguments are never optional. Solution: Support optional function arguments with a default value. (Andy Massimino, closes #3952)
author Bram Moolenaar <Bram@vim.org>
date Thu, 09 May 2019 21:15:05 +0200
parents bcc343175103
children 0daf9eca3541
line wrap: on
line diff
--- a/src/structs.h
+++ b/src/structs.h
@@ -1402,42 +1402,43 @@ typedef struct funccall_S funccall_T;
  */
 typedef struct
 {
-    int		uf_varargs;	/* variable nr of arguments */
+    int		uf_varargs;	// variable nr of arguments
     int		uf_flags;
-    int		uf_calls;	/* nr of active calls */
-    int		uf_cleared;	/* func_clear() was already called */
-    garray_T	uf_args;	/* arguments */
-    garray_T	uf_lines;	/* function lines */
+    int		uf_calls;	// nr of active calls
+    int		uf_cleared;	// func_clear() was already called
+    garray_T	uf_args;	// arguments
+    garray_T	uf_def_args;	// default argument expressions
+    garray_T	uf_lines;	// function lines
 # ifdef FEAT_PROFILE
-    int		uf_profiling;	/* TRUE when func is being profiled */
+    int		uf_profiling;	// TRUE when func is being profiled
     int		uf_prof_initialized;
-    /* profiling the function as a whole */
-    int		uf_tm_count;	/* nr of calls */
-    proftime_T	uf_tm_total;	/* time spent in function + children */
-    proftime_T	uf_tm_self;	/* time spent in function itself */
-    proftime_T	uf_tm_children;	/* time spent in children this call */
-    /* profiling the function per line */
-    int		*uf_tml_count;	/* nr of times line was executed */
-    proftime_T	*uf_tml_total;	/* time spent in a line + children */
-    proftime_T	*uf_tml_self;	/* time spent in a line itself */
-    proftime_T	uf_tml_start;	/* start time for current line */
-    proftime_T	uf_tml_children; /* time spent in children for this line */
-    proftime_T	uf_tml_wait;	/* start wait time for current line */
-    int		uf_tml_idx;	/* index of line being timed; -1 if none */
-    int		uf_tml_execed;	/* line being timed was executed */
+    // profiling the function as a whole
+    int		uf_tm_count;	// nr of calls
+    proftime_T	uf_tm_total;	// time spent in function + children
+    proftime_T	uf_tm_self;	// time spent in function itself
+    proftime_T	uf_tm_children;	// time spent in children this call
+    // profiling the function per line
+    int		*uf_tml_count;	// nr of times line was executed
+    proftime_T	*uf_tml_total;	// time spent in a line + children
+    proftime_T	*uf_tml_self;	// time spent in a line itself
+    proftime_T	uf_tml_start;	// start time for current line
+    proftime_T	uf_tml_children; // time spent in children for this line
+    proftime_T	uf_tml_wait;	// start wait time for current line
+    int		uf_tml_idx;	// index of line being timed; -1 if none
+    int		uf_tml_execed;	// line being timed was executed
 # endif
-    sctx_T	uf_script_ctx;	/* SCTX where function was defined,
-				   used for s: variables */
-    int		uf_refcount;	/* reference count, see func_name_refcount() */
-    funccall_T	*uf_scoped;	/* l: local variables for closure */
-    char_u	uf_name[1];	/* name of function (actually longer); can
-				   start with <SNR>123_ (<SNR> is K_SPECIAL
-				   KS_EXTRA KE_SNR) */
+    sctx_T	uf_script_ctx;	// SCTX where function was defined,
+				// used for s: variables
+    int		uf_refcount;	// reference count, see func_name_refcount()
+    funccall_T	*uf_scoped;	// l: local variables for closure
+    char_u	uf_name[1];	// name of function (actually longer); can
+				// start with <SNR>123_ (<SNR> is K_SPECIAL
+				// KS_EXTRA KE_SNR)
 } ufunc_T;
 
-#define MAX_FUNC_ARGS	20	/* maximum number of function arguments */
-#define VAR_SHORT_LEN	20	/* short variable name length */
-#define FIXVAR_CNT	12	/* number of fixed variables */
+#define MAX_FUNC_ARGS	20	// maximum number of function arguments
+#define VAR_SHORT_LEN	20	// short variable name length
+#define FIXVAR_CNT	12	// number of fixed variables
 
 /* structure to hold info for a function that is currently being executed. */
 struct funccall_S