mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.0918: duplicate code for evaluating expression argument
Problem: Duplicate code for evaluating expression argument. Solution: Merge the code and make the use more flexible.
This commit is contained in:
12
src/eval.c
12
src/eval.c
@@ -211,6 +211,18 @@ eval1_emsg(char_u **arg, typval_T *rettv, int 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;
|
||||
*/
|
||||
int
|
||||
eval_expr_valid_arg(typval_T *tv)
|
||||
{
|
||||
return tv->v_type != VAR_UNKNOWN
|
||||
&& (tv->v_type != VAR_STRING
|
||||
|| (tv->vval.v_string != NULL && *tv->vval.v_string != NUL));
|
||||
}
|
||||
|
||||
/*
|
||||
* Evaluate an expression, which can be a function, partial or string.
|
||||
* Pass arguments "argv[argc]".
|
||||
|
Reference in New Issue
Block a user