diff options
-rw-r--r-- | src/blob.c | 9 | ||||
-rw-r--r-- | src/channel.c | 21 | ||||
-rw-r--r-- | src/clientserver.c | 19 | ||||
-rw-r--r-- | src/cmdexpand.c | 6 | ||||
-rw-r--r-- | src/cmdhist.c | 3 | ||||
-rw-r--r-- | src/dict.c | 5 | ||||
-rw-r--r-- | src/diff.c | 4 | ||||
-rw-r--r-- | src/errors.h | 6 | ||||
-rw-r--r-- | src/eval.c | 9 | ||||
-rw-r--r-- | src/evalbuffer.c | 18 | ||||
-rw-r--r-- | src/evalfunc.c | 488 | ||||
-rw-r--r-- | src/evalvars.c | 32 | ||||
-rw-r--r-- | src/evalwindow.c | 9 | ||||
-rw-r--r-- | src/filepath.c | 30 | ||||
-rw-r--r-- | src/globals.h | 5 | ||||
-rw-r--r-- | src/insexpand.c | 11 | ||||
-rw-r--r-- | src/job.c | 20 | ||||
-rw-r--r-- | src/list.c | 32 | ||||
-rw-r--r-- | src/map.c | 6 | ||||
-rw-r--r-- | src/match.c | 9 | ||||
-rw-r--r-- | src/proto/typval.pro | 14 | ||||
-rw-r--r-- | src/quickfix.c | 15 | ||||
-rw-r--r-- | src/search.c | 26 | ||||
-rw-r--r-- | src/sign.c | 6 | ||||
-rw-r--r-- | src/strings.c | 25 | ||||
-rw-r--r-- | src/terminal.c | 40 | ||||
-rw-r--r-- | src/testdir/test_blob.vim | 28 | ||||
-rw-r--r-- | src/testdir/test_gui.vim | 10 | ||||
-rw-r--r-- | src/testdir/test_vim9_builtin.vim | 552 | ||||
-rw-r--r-- | src/testing.c | 13 | ||||
-rw-r--r-- | src/textprop.c | 30 | ||||
-rw-r--r-- | src/time.c | 10 | ||||
-rw-r--r-- | src/typval.c | 203 | ||||
-rw-r--r-- | src/version.c | 2 |
34 files changed, 1417 insertions, 299 deletions
diff --git a/src/blob.c b/src/blob.c index 4685dc97c1..6855935ec9 100644 --- a/src/blob.c +++ b/src/blob.c @@ -415,9 +415,16 @@ blob_set_range(blob_T *dest, long n1, long n2, typval_T *src) blob_remove(typval_T *argvars, typval_T *rettv) { int error = FALSE; - long idx = (long)tv_get_number_chk(&argvars[1], &error); + long idx; long end; + if (in_vim9script() + && (check_for_blob_arg(argvars, 0) == FAIL + || check_for_number_arg(argvars, 1) == FAIL + || check_for_opt_number_arg(argvars, 2) == FAIL)) + return; + + idx = (long)tv_get_number_chk(&argvars[1], &error); if (!error) { blob_T *b = argvars[0].vval.v_blob; diff --git a/src/channel.c b/src/channel.c index c0572d3311..5f78777a37 100644 --- a/src/channel.c +++ b/src/channel.c @@ -4270,6 +4270,11 @@ ch_expr_common(typval_T *argvars, typval_T *rettv, int eval) rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; + if (in_vim9script() + && (check_for_chan_or_job_arg(argvars, 0) == FAIL + || check_for_opt_dict_arg(argvars, 2) == FAIL)) + return; + channel = get_channel_arg(&argvars[0], TRUE, FALSE, 0); if (channel == NULL) return; @@ -4330,6 +4335,12 @@ ch_raw_common(typval_T *argvars, typval_T *rettv, int eval) rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; + if (in_vim9script() + && (check_for_chan_or_job_arg(argvars, 0) == FAIL + || check_for_string_or_blob_arg(argvars, 1) == FAIL + || check_for_opt_dict_arg(argvars, 2) == FAIL)) + return; + if (argvars[1].v_type == VAR_BLOB) { text = argvars[1].vval.v_blob->bv_ga.ga_data; @@ -4815,9 +4826,16 @@ f_ch_close_in(typval_T *argvars, typval_T *rettv UNUSED) void f_ch_getbufnr(typval_T *argvars, typval_T *rettv) { - channel_T *channel = get_channel_arg(&argvars[0], FALSE, FALSE, 0); + channel_T *channel; rettv->vval.v_number = -1; + + if (in_vim9script() + && (check_for_chan_or_job_arg(argvars, 0) == FAIL + || check_for_string_arg(argvars, 1) == FAIL)) + return; + + channel = get_channel_arg(&argvars[0], FALSE, FALSE, 0); if (channel != NULL) { char_u *what = tv_get_string(&argvars[1]); @@ -4894,6 +4912,7 @@ f_ch_logfile(typval_T *argvars, typval_T *rettv UNUSED) // Don't open a file in restricted mode. if (check_restricted() || check_secure()) return; + if (in_vim9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL)) diff --git a/src/clientserver.c b/src/clientserver.c index 00bea6f56a..3c0a930ed1 100644 --- a/src/clientserver.c +++ b/src/clientserver.c @@ -793,6 +793,15 @@ f_remote_expr(typval_T *argvars UNUSED, typval_T *rettv) { rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; + + if (in_vim9script() + && (check_for_string_arg(argvars, 0) == FAIL + || check_for_string_arg(argvars, 1) == FAIL + || check_for_opt_string_arg(argvars, 2) == FAIL + || (argvars[2].v_type != VAR_UNKNOWN + && check_for_opt_number_arg(argvars, 3) == FAIL))) + return; + #ifdef FEAT_CLIENTSERVER remote_common(argvars, rettv, TRUE); #endif @@ -891,8 +900,7 @@ f_remote_read(typval_T *argvars UNUSED, typval_T *rettv) if (in_vim9script() && (check_for_string_arg(argvars, 0) == FAIL - || (argvars[1].v_type != VAR_UNKNOWN - && check_for_number_arg(argvars, 1) == FAIL))) + || check_for_opt_number_arg(argvars, 1) == FAIL)) return; serverid = tv_get_string_chk(&argvars[0]); @@ -932,6 +940,13 @@ f_remote_send(typval_T *argvars UNUSED, typval_T *rettv) { rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; + + if (in_vim9script() + && (check_for_string_arg(argvars, 0) == FAIL + || check_for_string_arg(argvars, 1) == FAIL + || check_for_opt_string_arg(argvars, 2) == FAIL)) + return; + #ifdef FEAT_CLIENTSERVER remote_common(argvars, rettv, FALSE); #endif diff --git a/src/cmdexpand.c b/src/cmdexpand.c index 9b6d9aa81d..362ed77e24 100644 --- a/src/cmdexpand.c +++ b/src/cmdexpand.c @@ -2891,6 +2891,12 @@ f_getcompletion(typval_T *argvars, typval_T *rettv) int options = WILD_SILENT | WILD_USE_NL | WILD_ADD_SLASH | WILD_NO_BEEP; + if (in_vim9script() + && (check_for_string_arg(argvars, 0) == FAIL + || check_for_string_arg(argvars, 1) == FAIL + || check_for_opt_bool_arg(argvars, 2) == FAIL)) + return; + if (argvars[1].v_type != VAR_STRING) { semsg(_(e_invarg2), "type must be a string"); diff --git a/src/cmdhist.c b/src/cmdhist.c index 1b04e62237..dee95ba379 100644 --- a/src/cmdhist.c +++ b/src/cmdhist.c @@ -599,8 +599,7 @@ f_histget(typval_T *argvars UNUSED, typval_T *rettv) if (in_vim9script() && (check_for_string_arg(argvars, 0) == FAIL - || (argvars[1].v_type != VAR_UNKNOWN - && check_for_number_arg(argvars, 1) == FAIL))) + || check_for_opt_number_arg(argvars, 1) == FAIL)) return; str = tv_get_string_chk(&argvars[0]); // NULL on type error diff --git a/src/dict.c b/src/dict.c index f0f045b272..8bcf28c72f 100644 --- a/src/dict.c +++ b/src/dict.c @@ -1340,6 +1340,11 @@ dict_remove(typval_T *argvars, typval_T *rettv, char_u *arg_errmsg) char_u *key; dictitem_T *di; + if (in_vim9script() + && (check_for_dict_arg(argvars, 0) == FAIL + || check_for_string_or_number_arg(argvars, 1) == FAIL)) + return; + if (argvars[2].v_type != VAR_UNKNOWN) semsg(_(e_toomanyarg), "remove()"); else if ((d = argvars[0].vval.v_dict) != NULL diff --git a/src/diff.c b/src/diff.c index 4c8afb12bd..59dc658eb7 100644 --- a/src/diff.c +++ b/src/diff.c @@ -3294,9 +3294,7 @@ f_diff_hlID(typval_T *argvars UNUSED, typval_T *rettv UNUSED) int col; if (in_vim9script() - && ((argvars[0].v_type != VAR_STRING - && argvars[0].v_type != VAR_NUMBER - && check_for_string_arg(argvars, 0) == FAIL) + && (check_for_string_or_number_arg(argvars,0) == FAIL || check_for_number_arg(argvars, 1) == FAIL)) return; diff --git a/src/errors.h b/src/errors.h index af42428c55..c5f8530f50 100644 --- a/src/errors.h +++ b/src/errors.h @@ -520,3 +520,9 @@ EXTERN char e_digraph_argument_must_be_one_character_str[] EXTERN char e_setdigraphlist_argument_must_be_list_of_lists_with_two_items[] INIT(= N_("E1216: setdigraphlist() argument must be a list of lists with two items")); #endif +EXTERN char e_blob_required_for_argument_nr[] + INIT(= N_("E1217: Blob required for argument %d")); +EXTERN char e_chan_or_job_required_for_argument_nr[] + INIT(= N_("E1218: Channel or Job required for argument %d")); +EXTERN char e_job_required_for_argument_nr[] + INIT(= N_("E1219: Job required for argument %d")); diff --git a/src/eval.c b/src/eval.c index 77774b738d..a5c889af87 100644 --- a/src/eval.c +++ b/src/eval.c @@ -4184,6 +4184,15 @@ check_can_index(typval_T *rettv, int evaluate, int verbose) void f_slice(typval_T *argvars, typval_T *rettv) { + if (in_vim9script() + && ((argvars[0].v_type != VAR_LIST + && argvars[0].v_type != VAR_BLOB + && argvars[0].v_type != VAR_STRING + && check_for_list_arg(argvars, 0) == FAIL) + || check_for_number_arg(argvars, 1) == FAIL + || check_for_opt_number_arg(argvars, 2) == FAIL)) + return; + if (check_can_index(argvars, TRUE, FALSE) == OK) { copy_tv(argvars, rettv); diff --git a/src/evalbuffer.c b/src/evalbuffer.c index 8a6c52d707..6f552c7193 100644 --- a/src/evalbuffer.c +++ b/src/evalbuffer.c @@ -387,6 +387,12 @@ f_bufnr(typval_T *argvars, typval_T *rettv) int error = FALSE; char_u *name; + if (in_vim9script() + && (check_for_opt_string_or_number_arg(argvars, 0) == FAIL + || (argvars[0].v_type != VAR_UNKNOWN + && check_for_opt_bool_arg(argvars, 1) == FAIL))) + return; + if (argvars[0].v_type == VAR_UNKNOWN) buf = curbuf; else @@ -459,6 +465,12 @@ f_deletebufline(typval_T *argvars, typval_T *rettv) tabpage_T *tp; win_T *wp; + if (in_vim9script() + && (check_for_buffer_arg(argvars, 0) == FAIL + || check_for_lnum_arg(argvars, 1) == FAIL + || check_for_opt_lnum_arg(argvars, 2) == FAIL)) + return; + buf = tv_get_buf(&argvars[0], FALSE); if (buf == NULL) { @@ -727,6 +739,12 @@ f_getbufline(typval_T *argvars, typval_T *rettv) linenr_T end = 1; buf_T *buf; + if (in_vim9script() + && (check_for_buffer_arg(argvars, 0) == FAIL + || check_for_lnum_arg(argvars, 1) == FAIL + || check_for_opt_lnum_arg(argvars, 2) == FAIL)) + return; + buf = tv_get_buf_from_arg(&argvars[0]); if (buf != NULL) { diff --git a/src/evalfunc.c b/src/evalfunc.c index 1a7f427815..ad44156bd3 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -300,7 +300,7 @@ arg_bool(type_T *type, argcontext_T *context) } /* - * Check "type" is a list or a blob. + * Check "type" is a list of 'any' or a blob. */ static int arg_list_or_blob(type_T *type, argcontext_T *context) @@ -324,6 +324,33 @@ arg_string_or_nr(type_T *type, argcontext_T *context) arg_type_mismatch(&t_string, type, context->arg_idx + 1); return FAIL; } + +/* + * Check "type" is a string or a number (buffer) + */ + static int +arg_buffer(type_T *type, argcontext_T *context) +{ + if (type->tt_type == VAR_ANY + || type->tt_type == VAR_STRING || type->tt_type == VAR_NUMBER) + return OK; + arg_type_mismatch(&t_string, type, context->arg_idx + 1); + return FAIL; +} + +/* + * Check "type" is a string or a number (line) + */ + static int +arg_lnum(type_T *type, argcontext_T *context) +{ + if (type->tt_type == VAR_ANY + || type->tt_type == VAR_STRING || type->tt_type == VAR_NUMBER) + return OK; + arg_type_mismatch(&t_string, type, context->arg_idx + 1); + return FAIL; +} + /* * Check "type" is a string or a list of strings. */ @@ -359,6 +386,19 @@ arg_string_or_list_any(type_T *type, argcontext_T *context) } /* + * Check "type" is a string or a blob + */ + static int +arg_string_or_blob(type_T *type, argcontext_T *context) +{ + if (type->tt_type == VAR_ANY + || type->tt_type == VAR_STRING || type->tt_type == VAR_BLOB) + return OK; + arg_type_mismatch(&t_string, type, context->arg_idx + 1); + return FAIL; +} + +/* * Check "type" is a list of 'any' or a dict of 'any'. */ static int @@ -372,6 +412,21 @@ arg_list_or_dict(type_T *type, argcontext_T *context) } /* + * Check "type" is a list of 'any' or a dict of 'any' or a blob. + */ + static int +arg_list_or_dict_or_blob(type_T *type, argcontext_T *context) +{ + if (type->tt_type == VAR_ANY + || type->tt_type == VAR_LIST + || type->tt_type == VAR_DICT + || type->tt_type == VAR_BLOB) + return OK; + arg_type_mismatch(&t_list_any, type, context->arg_idx + 1); + return FAIL; +} + +/* * Check "type" is a job. */ static int @@ -386,8 +441,9 @@ arg_job(type_T *type, argcontext_T *context) static int arg_chan_or_job(type_T *type, argcontext_T *context) { - if (type->tt_type == VAR_ANY || - type->tt_type == VAR_CHANNEL || type->tt_type == VAR_JOB) + if (type->tt_type == VAR_ANY + || type->tt_type == VAR_CHANNEL + || type->tt_type == VAR_JOB) return OK; arg_type_mismatch(&t_channel, type, context->arg_idx + 1); return FAIL; @@ -457,6 +513,20 @@ arg_str_or_nr_or_list(type_T *type, argcontext_T *context) } /* + * Check "type" is a dict of 'any' or a string + */ + static int +arg_dict_any_or_string(type_T *type, argcontext_T *context) +{ + if (type->tt_type == VAR_ANY + || type->tt_type == VAR_DICT + || type->tt_type == VAR_STRING) + return OK; + arg_type_mismatch(&t_string, type, context->arg_idx + 1); + return FAIL; +} + +/* * Check "type" which is the third argument of extend(). */ static int @@ -471,6 +541,65 @@ arg_extend3(type_T *type, argcontext_T *context) return OK; } +/* + * Check "type" which is the second argument of remove(). + */ + static int +arg_remove2(type_T *type, argcontext_T *context) +{ + type_T *first_type = context->arg_types[context->arg_idx - 1]; + + if (first_type->tt_type == VAR_LIST || first_type->tt_type == VAR_BLOB) + return arg_number(type, context); + if (first_type->tt_type == VAR_DICT) + return arg_string_or_nr(type, context); + return OK; +} + +/* + * Check "type" which is the first argument of slice(). + */ + static int +arg_slice1(type_T *type, argcontext_T *context) +{ + if (type->tt_type == VAR_LIST + || type->tt_type == VAR_BLOB + || type->tt_type == VAR_STRING) + return OK; + + arg_type_mismatch(&t_list_any, type, context->arg_idx + 1); + return FAIL; +} + +/* + * Check "type" which is the first argument of count(). + */ + static int +arg_count1(type_T *type, argcontext_T *context) +{ + if (type->tt_type == VAR_STRING + || type->tt_type == VAR_LIST + || type->tt_type == VAR_DICT) + return OK; + + arg_type_mismatch(&t_string, type, context->arg_idx + 1); + return FAIL; +} + +/* + * Check "type" which is the first argument of cursor(). + */ + static int +arg_cursor1(type_T *type, argcontext_T *context) +{ + if (type->tt_type == VAR_NUMBER + || type->tt_type == VAR_STRING + || type->tt_type == VAR_LIST) + return OK; + + arg_type_mismatch(&t_number, type, context->arg_idx + 1); + return FAIL; +} /* * Lists of functions that check the argument types of a builtin function. @@ -481,7 +610,7 @@ static argcheck_T arg1_bool[] = {arg_bool}; static argcheck_T arg1_dict_any[] = {arg_dict_any}; static argcheck_T arg1_job[] = {arg_job}; static argcheck_T arg1_list_any[] = {arg_list_any}; -static argcheck_T arg1_list_nr[] = {arg_list_number}; +static argcheck_T arg1_list_number[] = {arg_list_number}; static argcheck_T arg1_list_string[] = {arg_list_string}; static argcheck_T arg1_float_or_nr[] = {arg_float_or_nr}; static argcheck_T arg1_string_or_nr[] = {arg_string_or_nr}; @@ -490,35 +619,74 @@ static argcheck_T arg1_string_or_list_string[] = {arg_string_or_list_string}; static argcheck_T arg1_list_or_blob[] = {arg_list_or_blob}; static argcheck_T arg1_list_or_dict[] = {arg_list_or_dict}; static argcheck_T arg1_chan_or_job[] = {arg_chan_or_job}; +static argcheck_T arg1_dict_or_string[] = {arg_dict_any_or_string}; static argcheck_T arg2_float_or_nr[] = {arg_float_or_nr, arg_float_or_nr}; static argcheck_T arg2_number[] = {arg_number, arg_number}; static argcheck_T arg2_string[] = {arg_string, arg_string}; static argcheck_T arg2_string_number[] = {arg_string, arg_number}; static argcheck_T arg2_list_nr[] = {arg_list_number, arg_list_number}; +static argcheck_T arg2_list_any_string[] = {arg_list_any, arg_string}; +static argcheck_T arg2_list_any_number[] = {arg_list_any, arg_number}; +static argcheck_T arg2_list_number_bool[] = {arg_list_number, arg_bool}; static argcheck_T arg2_nr_string[] = {arg_number, arg_string}; +static argcheck_T arg2_nr_bool[] = {arg_number, arg_bool}; +static argcheck_T arg2_nr_list[] = {arg_number, arg_list_any}; static argcheck_T arg2_dict_string[] = {arg_dict_any, arg_string}; static argcheck_T arg2_dict_string_or_nr[] = {arg_dict_any, arg_string_or_nr}; static argcheck_T arg2_string_dict[] = {arg_string, arg_dict_any}; -static argcheck_T arg2_string_nr[] = {arg_string, arg_number}; +static argcheck_T arg2_string_list_nr[] = {arg_string, arg_list_number}; static argcheck_T arg2_string_bool[] = {arg_string, arg_bool}; +static argcheck_T arg2_job_dict[] = {arg_job, arg_dict_any}; +static argcheck_T arg2_job_string_or_number[] = {arg_job, arg_string_or_nr}; //static argcheck_T arg2_listblob_item[] = {arg_list_or_blob, arg_item_of_prev}; static argcheck_T arg2_str_or_nr_or_list_dict[] = {arg_str_or_nr_or_list, arg_dict_any}; static argcheck_T arg2_string_or_list_dict[] = {arg_string_or_list_any, arg_dict_any}; static argcheck_T arg2_string_or_nr_string[] = {arg_string_or_nr, arg_string}; static argcheck_T arg2_string_or_nr_nr[] = {arg_string_or_nr, arg_number}; +static argcheck_T arg2_string_or_nr_bool[] = {arg_string_or_nr, arg_bool}; static argcheck_T arg2_chan_or_job_dict[] = {arg_chan_or_job, arg_dict_any}; +static argcheck_T arg2_chan_or_job_string[] = {arg_chan_or_job, arg_string}; static argcheck_T arg2_nr_dict_any[] = {arg_number, arg_dict_any}; -//static argcheck_T arg2_string_number[] = {arg_string, arg_number}; static argcheck_T arg3_string[] = {arg_string, arg_string, arg_string}; static argcheck_T arg3_number[] = {arg_number, arg_number, arg_number}; +static argcheck_T arg3_number_number_dict[] = {arg_number, arg_number, arg_dict_any}; +static argcheck_T arg3_number_string_any[] = {arg_number, arg_string, NULL}; static argcheck_T arg3_string_nr_bool[] = {arg_string, arg_number, arg_bool}; static argcheck_T arg3_string_string_nr[] = {arg_string, arg_string, arg_number}; +static argcheck_T arg3_string_string_bool[] = {arg_string, arg_string, arg_bool}; +static argcheck_T arg3_string_bool_bool[] = {arg_string, arg_bool, arg_bool}; +static argcheck_T arg3_string_bool_dict[] = {arg_string, arg_bool, arg_dict_any}; +static argcheck_T arg3_list_string_dict[] = {arg_list_any, arg_string, arg_dict_any}; +static argcheck_T arg3_dict_number_number[] = {arg_dict_any, arg_number, arg_number}; +static argcheck_T arg3_string_or_nr_nr_bool[] = {arg_string_or_nr, arg_number, arg_bool}; +static argcheck_T arg3_bufnr_lnum_lnum[] = {arg_buffer, arg_lnum, arg_lnum}; +static argcheck_T arg4_number_number_string_any[] = {arg_number, arg_number, arg_string, NULL}; +static argcheck_T arg5_number[] = {arg_number, arg_number, arg_number, arg_number, arg_number}; +static argcheck_T arg4_browse[] = {arg_bool, arg_string, arg_string, arg_string}; +static argcheck_T arg3_chanexpr[] = {arg_chan_or_job, NULL, arg_dict_any}; +static argcheck_T arg3_chanraw[] = {arg_chan_or_job, arg_string_or_blob, arg_dict_any}; +static argcheck_T arg4_count[] = {arg_count1, NULL, arg_bool, arg_number}; +static argcheck_T arg3_cursor[] = {arg_cursor1, arg_number, arg_number}; +static argcheck_T arg2_deepcopy[] = {NULL, arg_bool}; static argcheck_T arg2_execute[] = {arg_string_or_list_string, arg_string}; static argcheck_T arg23_extend[] = {arg_list_or_dict, arg_same_as_prev, arg_extend3}; static argcheck_T arg23_extendnew[] = {arg_list_or_dict, arg_same_struct_as_prev, arg_extend3}; +static argcheck_T arg4_glob[] = {arg_string, arg_bool, arg_bool, arg_bool}; +static argcheck_T arg5_globpath[] = {arg_string, arg_string, arg_bool, arg_bool, arg_bool}; +static argcheck_T arg4_index[] = {arg_list_or_blob, NULL, arg_number, arg_bool}; static argcheck_T arg3_insert[] = {arg_list_or_blob, arg_item_of_prev, arg_number}; +static argcheck_T arg4_maparg[] = {arg_string, arg_string, arg_bool, arg_bool}; +static argcheck_T arg4_remote_expr[] = {arg_string, arg_string, arg_string, arg_number}; +static argcheck_T arg3_remove[] = {arg_list_or_dict_or_blob, arg_remove2, arg_number}; static argcheck_T arg3_setbufline[] = {arg_string_or_nr, arg_string_or_nr, arg_str_or_nr_or_list}; static argcheck_T arg2_setline[] = {arg_string_or_nr, NULL}; +static argcheck_T arg4_setloclist[] = {arg_number, arg_list_any, arg_string, arg_dict_any}; +static argcheck_T arg3_setqflist[] = {arg_list_any, arg_string, arg_dict_any}; +static argcheck_T arg2_settagstack[] = {arg_number, arg_dict_any, arg_string}; +static argcheck_T arg2_sign_getplaced[] = {arg_string_or_nr, arg_dict_any}; +static argcheck_T arg3_slice[] = {arg_slice1, arg_number, arg_number}; +static argcheck_T arg4_strpart[] = {arg_string, arg_number, arg_number, arg_bool}; +static argcheck_T arg2_term_setansicolors[] = {arg_string_or_nr, arg_list_any}; static argcheck_T arg23_win_execute[] = {arg_number, arg_string_or_list_string, arg_string}; static argcheck_T arg4_match_func[] = {arg_string_or_list_any, arg_string, arg_number, arg_number}; @@ -866,7 +1034,7 @@ static funcentry_T global_functions[] = NULL #endif }, - {"browse", 4, 4, 0, NULL, + {"browse", 4, 4, 0, arg4_browse, ret_string, f_browse}, {"browsedir", 2, 2, 0, arg2_string, ret_string, f_browsedir}, @@ -878,7 +1046,7 @@ static funcentry_T global_functions[] = ret_number_bool, f_bufexists}, {"buffer_name", 0, 1, FEARG_1, arg1_string_or_nr, // obsolete ret_string, f_bufname}, - {"buffer_number", 0, 1, FEARG_1, NULL, // obsolete + {"buffer_number", 0, 1, FEARG_1, arg2_string_or_nr_bool, // obsolete ret_number, f_bufnr}, {"buflisted", 1, 1, FEARG_1, arg1_string_or_nr, ret_number_bool, f_buflisted}, @@ -888,7 +1056,7 @@ static funcentry_T global_functions[] = ret_number_bool, f_bufloaded}, {"bufname", 0, 1, FEARG_1, arg1_string_or_nr, ret_string, f_bufname}, - {"bufnr", 0, 2, FEARG_1, NULL, + {"bufnr", 0, 2, FEARG_1, arg2_string_or_nr_bool, ret_number, f_bufnr}, {"bufwinid", 1, 1, FEARG_1, arg1_string_or_nr, ret_number, f_bufwinid}, @@ -896,9 +1064,9 @@ static funcentry_T global_functions[] = ret_number, f_bufwinnr}, {"byte2line", 1, 1, FEARG_1, arg1_number, ret_number, f_byte2line}, - {"byteidx", 2, 2, FEARG_1, arg2_string_nr, + {"byteidx", 2, 2, FEARG_1, arg2_string_number, ret_number, f_byteidx}, - {"byteidxcomp", 2, 2, FEARG_1, arg2_string_nr, + {"byteidxcomp", 2, 2, FEARG_1, arg2_string_number, ret_number, f_byteidxcomp}, {"call", 2, 3, FEARG_1, NULL, ret_any, f_call}, @@ -910,11 +1078,11 @@ static funcentry_T global_functions[] = ret_void, JOB_FUNC(f_ch_close)}, {"ch_close_in", 1, 1, FEARG_1, arg1_chan_or_job, ret_void, JOB_FUNC(f_ch_close_in)}, - {"ch_evalexpr", 2, 3, FEARG_1, NULL, + {"ch_evalexpr", 2, 3, FEARG_1, arg3_chanexpr, ret_any, JOB_FUNC(f_ch_evalexpr)}, - {"ch_evalraw", 2, 3, FEARG_1, NULL, + {"ch_evalraw", 2, 3, FEARG_1, arg3_chanraw, ret_any, JOB_FUNC(f_ch_evalraw)}, - {"ch_getbufnr", 2, 2, FEARG_1, NULL, + {"ch_getbufnr", 2, 2, FEARG_1, arg2_chan_or_job_string, ret_number, JOB_FUNC(f_ch_getbufnr)}, {"ch_getjob", 1, 1, FEARG_1, arg1_chan_or_job, ret_job, JOB_FUNC(f_ch_getjob)}, @@ -932,9 +1100,9 @@ static funcentry_T global_functions[] = ret_blob, JOB_FUNC(f_ch_readblob)}, {"ch_readraw", 1, 2, FEARG_1, arg2_chan_or_job_dict, ret_string, JOB_FUNC(f_ch_readraw)}, - {"ch_sendexpr", 2, 3, FEARG_1, NULL, + {"ch_sendexpr", 2, 3, FEARG_1, arg3_chanexpr, ret_void, JOB_FUNC(f_ch_sendexpr)}, - {"ch_sendraw", 2, 3, FEARG_1, NULL, + {"ch_sendraw", 2, 3, FEARG_1, arg3_chanraw, ret_void, JOB_FUNC(f_ch_sendraw)}, {"ch_setoptions", 2, 2, FEARG_1, arg2_chan_or_job_dict, ret_void, JOB_FUNC(f_ch_setoptions)}, @@ -958,9 +1126,9 @@ static funcentry_T global_functions[] = ret_void, f_clearmatches}, {"col", 1, 1, FEARG_1, arg1_string_or_list_any, ret_number, f_col}, - {"complete", 2, 2, FEARG_2, NULL, + {"complete", 2, 2, FEARG_2, arg2_nr_list, ret_void, f_complete}, - {"complete_add", 1, 1, FEARG_1, NULL, + {"complete_add", 1, 1, FEARG_1, arg1_dict_or_string, ret_number, f_complete_add}, {"complete_check", 0, 0, 0, NULL, ret_number_bool, f_complete_check}, @@ -974,11 +1142,11 @@ static funcentry_T global_functions[] = ret_float, FLOAT_FUNC(f_cos)}, {"cosh", 1, 1, FEARG_1, arg1_float_or_nr, ret_float, FLOAT_FUNC(f_cosh)}, - {"count", 2, 4, FEARG_1, NULL, + {"count", 2, 4, FEARG_1, arg4_count, ret_number, f_count}, {"cscope_connection",0,3, 0, NULL, ret_number, f_cscope_connection}, - {"cursor", 1, 3, FEARG_1, NULL, + {"cursor", 1, 3, FEARG_1, arg3_cursor, ret_number, f_cursor}, {"debugbreak", 1, 1, FEARG_1, arg1_number, ret_number, @@ -988,11 +1156,11 @@ static funcentry_T global_functions[] = NULL #endif }, - {"deepcopy", 1, 2, FEARG_1, NULL, + {"deepcopy", 1, 2, FEARG_1, arg2_deepcopy, ret_first_arg, f_deepcopy}, {"delete", 1, 2, FEARG_1, arg2_string, ret_number_bool, f_delete}, - {"deletebufline", 2, 3, FEARG_1, NULL, + {"deletebufline", 2, 3, FEARG_1, arg3_bufnr_lnum_lnum, ret_number_bool, f_deletebufline}, {"did_filetype", 0, 0, 0, NULL, ret_number_bool, f_did_filetype}, @@ -1022,7 +1190,7 @@ static funcentry_T global_functions[] = ret_number_bool, f_exists}, {"exp", 1, 1, FEARG_1, arg1_float_or_nr, ret_float, FLOAT_FUNC(f_exp)}, - {"expand", 1, 3, FEARG_1, NULL, + {"expand", 1, 3, FEARG_1, arg3_string_bool_bool, ret_any, f_expand}, {"expandcmd", 1, 1, FEARG_1, arg1_string, ret_string, f_expandcmd}, @@ -1044,9 +1212,9 @@ static funcentry_T global_functions[] = ret_string, f_finddir}, {"findfile", 1, 3, FEARG_1, arg3_string_string_nr, ret_string, f_findfile}, - {"flatten", 1, 2, FEARG_1, NULL, + {"flatten", 1, 2, FEARG_1, arg2_list_any_number, ret_list_any, f_flatten}, - {"flattennew", 1, 2, FEARG_1, NULL, + {"flattennew", 1, 2, FEARG_1, arg2_list_any_number, ret_list_any, f_flattennew}, {"float2nr", 1, 1, FEARG_1, arg1_float_or_nr, ret_number, FLOAT_FUNC(f_float2nr)}, @@ -1082,7 +1250,7 @@ static funcentry_T global_functions[] = ret_any, f_get}, {"getbufinfo", 0, 1, FEARG_1, NULL, ret_list_dict_any, f_getbufinfo}, - {"getbufline", 2, 3, FEARG_1, NULL, + {"getbufline", 2, 3, FEARG_1, arg3_bufnr_lnum_lnum, ret_list_string, f_getbufline}, {"getbufvar", 2, 3, FEARG_1, NULL, ret_any, f_getbufvar}, @@ -1106,7 +1274,7 @@ static funcentry_T global_functions[] = ret_string, f_getcmdtype}, {"getcmdwintype", 0, 0, 0, NULL, ret_string, f_getcmdwintype}, - {"getcompletion", 2, 3, FEARG_1, NULL, + {"getcompletion", 2, 3, FEARG_1, arg3_string_string_bool, ret_list_string, f_getcompletion}, {"getcurpos", 0, 1, FEARG_1, arg1_number, ret_list_number, f_getcurpos}, @@ -1150,7 +1318,7 @@ static funcentry_T global_functions[] = ret_list_number, f_getpos}, {"getqflist", 0, 1, 0, arg1_dict_any, ret_list_or_dict_0, f_getqflist}, - {"getreg", 0, 3, FEARG_1, NULL, + {"getreg", 0, 3, FEARG_1, arg3_string_bool_bool, ret_getreg, f_getreg}, {"getreginfo", 0, 1, FEARG_1, arg1_string, ret_dict_any, f_getreginfo}, @@ -1158,9 +1326,9 @@ static funcentry_T global_functions[] = ret_string, f_getregtype}, {"gettabinfo", 0, 1, FEARG_1, arg1_number, ret_list_dict_any, f_gettabinfo}, - {"gettabvar", 2, 3, FEARG_1, NULL, + {"gettabvar", 2, 3, FEARG_1, arg3_number_string_any, ret_any, f_gettabvar}, - {"gettabwinvar", 3, 4, FEARG_1, NULL, + {"gettabwinvar", 3, 4, FEARG_1, arg4_number_number_string_any, ret_any, f_gettabwinvar}, {"gettagstack", 0, 1, FEARG_1, arg1_number, ret_dict_any, f_gettagstack}, @@ -1174,21 +1342,21 @@ static funcentry_T global_functions[] = ret_number, f_getwinposx}, {"getwinposy", 0, 0, 0, NULL, ret_number, f_getwinposy}, - {"getwinvar", 2, 3, FEARG_1, NULL, + {"getwinvar", 2, 3, FEARG_1, arg3_number_string_any, ret_any, f_getwinvar}, - {"glob", 1, 4, FEARG_1, NULL, + {"glob", 1, 4, FEARG_1, arg4_glob, ret_any, f_glob}, {"glob2regpat", 1, 1, FEARG_1, arg1_string, ret_string, f_glob2regpat}, - {"globpath", 2, 5, FEARG_2, NULL, + {"globpath", 2, 5, FEARG_2, arg5_globpath, ret_any, f_globpath}, - {"has", 1, 2, 0, NULL, + {"has", 1, 2, 0, arg2_string_bool, ret_number_bool, f_has}, {"has_key", 2, 2, FEARG_1, arg2_dict_string_or_nr, ret_number_bool, f_has_key}, {"haslocaldir", 0, 2, FEARG_1, arg2_number, ret_number, f_haslocaldir}, - {"hasmapto", 1, 3, FEARG_1, NULL, + {"hasmapto", 1, 3, FEARG_1, arg3_string_string_bool, ret_number_bool, f_hasmapto}, {"highlightID", 1, 1, FEARG_1, NULL, // obsolete ret_number, f_hlID}, @@ -1198,7 +1366,7 @@ static funcentry_T global_functions[] = ret_number_bool, f_histadd}, {"histdel", 1, 2, FEARG_1, NULL, ret_number_bool, f_histdel}, - {"histget", 1, 2, FEARG_1, arg2_string_nr, + {"histget", 1, 2, FEARG_1, arg2_string_number, ret_string, f_histget}, {"histnr", 1, 1, FEARG_1, arg1_string, ret_number, f_histnr}, @@ -1212,7 +1380,7 @@ static funcentry_T global_functions[] = ret_string, f_iconv}, {"indent", 1, 1, FEARG_1, arg1_string_or_nr, ret_number, f_indent}, - {"index", 2, 4, FEARG_1, NULL, + {"index", 2, 4, FEARG_1, arg4_index, ret_number, |