diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-08-08 14:43:22 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-08-08 14:43:22 +0200 |
commit | 267359902c8792fed13543ddeb56c6df0ae74957 (patch) | |
tree | 6bc6795fb6eb8d7be15bd5d5799218d5ccc12773 /src/evalfunc.c | |
parent | 9e2fa4bb9eb40a78a1ae1f67a4064651b5ce0aac (diff) |
patch 8.2.3314: behavior of exists() in a :def function is unpredictablev8.2.3314
Problem: Behavior of exists() in a :def function is unpredictable.
Solution: Add exists_compiled().
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r-- | src/evalfunc.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c index 7006afa498..95ae211eeb 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -49,6 +49,7 @@ static void f_escape(typval_T *argvars, typval_T *rettv); static void f_eval(typval_T *argvars, typval_T *rettv); static void f_eventhandler(typval_T *argvars, typval_T *rettv); static void f_execute(typval_T *argvars, typval_T *rettv); +static void f_exists_compiled(typval_T *argvars, typval_T *rettv); static void f_expand(typval_T *argvars, typval_T *rettv); static void f_expandcmd(typval_T *argvars, typval_T *rettv); static void f_feedkeys(typval_T *argvars, typval_T *rettv); @@ -1329,6 +1330,8 @@ static funcentry_T global_functions[] = ret_string, f_exepath}, {"exists", 1, 1, FEARG_1, arg1_string, ret_number_bool, f_exists}, + {"exists_compiled", 1, 1, FEARG_1, arg1_string, + ret_number_bool, f_exists_compiled}, {"exp", 1, 1, FEARG_1, arg1_float_or_nr, ret_float, FLOAT_FUNC(f_exp)}, {"expand", 1, 3, FEARG_1, arg3_string_bool_bool, @@ -3626,6 +3629,12 @@ f_exists(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = n; } + static void +f_exists_compiled(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ + emsg(_(e_exists_compiled_can_only_be_used_in_def_function)); +} + /* * "expand()" function */ |