comparison 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
comparison
equal deleted inserted replaced
16614:306acde1a598 16615:1a911bd57f11
1400 /* 1400 /*
1401 * Structure to hold info for a user function. 1401 * Structure to hold info for a user function.
1402 */ 1402 */
1403 typedef struct 1403 typedef struct
1404 { 1404 {
1405 int uf_varargs; /* variable nr of arguments */ 1405 int uf_varargs; // variable nr of arguments
1406 int uf_flags; 1406 int uf_flags;
1407 int uf_calls; /* nr of active calls */ 1407 int uf_calls; // nr of active calls
1408 int uf_cleared; /* func_clear() was already called */ 1408 int uf_cleared; // func_clear() was already called
1409 garray_T uf_args; /* arguments */ 1409 garray_T uf_args; // arguments
1410 garray_T uf_lines; /* function lines */ 1410 garray_T uf_def_args; // default argument expressions
1411 garray_T uf_lines; // function lines
1411 # ifdef FEAT_PROFILE 1412 # ifdef FEAT_PROFILE
1412 int uf_profiling; /* TRUE when func is being profiled */ 1413 int uf_profiling; // TRUE when func is being profiled
1413 int uf_prof_initialized; 1414 int uf_prof_initialized;
1414 /* profiling the function as a whole */ 1415 // profiling the function as a whole
1415 int uf_tm_count; /* nr of calls */ 1416 int uf_tm_count; // nr of calls
1416 proftime_T uf_tm_total; /* time spent in function + children */ 1417 proftime_T uf_tm_total; // time spent in function + children
1417 proftime_T uf_tm_self; /* time spent in function itself */ 1418 proftime_T uf_tm_self; // time spent in function itself
1418 proftime_T uf_tm_children; /* time spent in children this call */ 1419 proftime_T uf_tm_children; // time spent in children this call
1419 /* profiling the function per line */ 1420 // profiling the function per line
1420 int *uf_tml_count; /* nr of times line was executed */ 1421 int *uf_tml_count; // nr of times line was executed
1421 proftime_T *uf_tml_total; /* time spent in a line + children */ 1422 proftime_T *uf_tml_total; // time spent in a line + children
1422 proftime_T *uf_tml_self; /* time spent in a line itself */ 1423 proftime_T *uf_tml_self; // time spent in a line itself
1423 proftime_T uf_tml_start; /* start time for current line */ 1424 proftime_T uf_tml_start; // start time for current line
1424 proftime_T uf_tml_children; /* time spent in children for this line */ 1425 proftime_T uf_tml_children; // time spent in children for this line
1425 proftime_T uf_tml_wait; /* start wait time for current line */ 1426 proftime_T uf_tml_wait; // start wait time for current line
1426 int uf_tml_idx; /* index of line being timed; -1 if none */ 1427 int uf_tml_idx; // index of line being timed; -1 if none
1427 int uf_tml_execed; /* line being timed was executed */ 1428 int uf_tml_execed; // line being timed was executed
1428 # endif 1429 # endif
1429 sctx_T uf_script_ctx; /* SCTX where function was defined, 1430 sctx_T uf_script_ctx; // SCTX where function was defined,
1430 used for s: variables */ 1431 // used for s: variables
1431 int uf_refcount; /* reference count, see func_name_refcount() */ 1432 int uf_refcount; // reference count, see func_name_refcount()
1432 funccall_T *uf_scoped; /* l: local variables for closure */ 1433 funccall_T *uf_scoped; // l: local variables for closure
1433 char_u uf_name[1]; /* name of function (actually longer); can 1434 char_u uf_name[1]; // name of function (actually longer); can
1434 start with <SNR>123_ (<SNR> is K_SPECIAL 1435 // start with <SNR>123_ (<SNR> is K_SPECIAL
1435 KS_EXTRA KE_SNR) */ 1436 // KS_EXTRA KE_SNR)
1436 } ufunc_T; 1437 } ufunc_T;
1437 1438
1438 #define MAX_FUNC_ARGS 20 /* maximum number of function arguments */ 1439 #define MAX_FUNC_ARGS 20 // maximum number of function arguments
1439 #define VAR_SHORT_LEN 20 /* short variable name length */ 1440 #define VAR_SHORT_LEN 20 // short variable name length
1440 #define FIXVAR_CNT 12 /* number of fixed variables */ 1441 #define FIXVAR_CNT 12 // number of fixed variables
1441 1442
1442 /* structure to hold info for a function that is currently being executed. */ 1443 /* structure to hold info for a function that is currently being executed. */
1443 struct funccall_S 1444 struct funccall_S
1444 { 1445 {
1445 ufunc_T *func; /* function being called */ 1446 ufunc_T *func; /* function being called */