diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2022-02-12 12:28:28 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-12 12:28:28 +0000 |
commit | cc9d08069aa41d5c5bae598e625a76279bb0a817 (patch) | |
tree | 6446aa6258d084199bcf2a505a3443e70be509a8 /src/nvim/eval.c | |
parent | e126fbc97117171cf0e0afe5ded707fa27f16b83 (diff) | |
parent | db06fb47b9ae2fd69570d68a667c9d1695fd123f (diff) | |
download | rneovim-cc9d08069aa41d5c5bae598e625a76279bb0a817.tar.gz rneovim-cc9d08069aa41d5c5bae598e625a76279bb0a817.tar.bz2 rneovim-cc9d08069aa41d5c5bae598e625a76279bb0a817.zip |
Merge pull request #17269 from seandewar/vim-8.2.0915
vim-patch:8.2.{0915,0918,0922,4355}
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index c197754685..4b83bda804 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -766,6 +766,15 @@ static int eval1_emsg(char_u **arg, typval_T *rettv, bool evaluate) return ret; } +/// @return whether a typval is a valid expression to pass to eval_expr_typval() +/// or eval_expr_to_bool(). An empty string returns false; +bool eval_expr_valid_arg(const typval_T *const tv) + FUNC_ATTR_NONNULL_ALL FUNC_ATTR_CONST +{ + return tv->v_type != VAR_UNKNOWN + && (tv->v_type != VAR_STRING || (tv->vval.v_string != NULL && *tv->vval.v_string != NUL)); +} + int eval_expr_typval(const typval_T *expr, typval_T *argv, int argc, typval_T *rettv) FUNC_ATTR_NONNULL_ARG(1, 2, 4) { |