mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 9.0.1452: code using EVAL_CONSTANT is dead, it is never set
Problem: Code using EVAL_CONSTANT is dead, it is never set. Solution: Remove EVAL_CONSTANT. (closes #12252)
This commit is contained in:
14
src/eval.c
14
src/eval.c
@@ -2358,7 +2358,7 @@ eval_func(
|
|||||||
// Need to make a copy, in case evaluating the arguments makes
|
// Need to make a copy, in case evaluating the arguments makes
|
||||||
// the name invalid.
|
// the name invalid.
|
||||||
s = vim_strsave(s);
|
s = vim_strsave(s);
|
||||||
if (s == NULL || (evaluate && (*s == NUL || (flags & EVAL_CONSTANT))))
|
if (s == NULL || (evaluate && *s == NUL))
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2647,7 +2647,6 @@ eval0_retarg(
|
|||||||
char_u *expr_end;
|
char_u *expr_end;
|
||||||
int did_emsg_before = did_emsg;
|
int did_emsg_before = did_emsg;
|
||||||
int called_emsg_before = called_emsg;
|
int called_emsg_before = called_emsg;
|
||||||
int flags = evalarg == NULL ? 0 : evalarg->eval_flags;
|
|
||||||
int check_for_end = retarg == NULL;
|
int check_for_end = retarg == NULL;
|
||||||
int end_error = FALSE;
|
int end_error = FALSE;
|
||||||
|
|
||||||
@@ -2692,7 +2691,6 @@ eval0_retarg(
|
|||||||
if (!aborting()
|
if (!aborting()
|
||||||
&& did_emsg == did_emsg_before
|
&& did_emsg == did_emsg_before
|
||||||
&& called_emsg == called_emsg_before
|
&& called_emsg == called_emsg_before
|
||||||
&& (flags & EVAL_CONSTANT) == 0
|
|
||||||
&& (!in_vim9script() || !vim9_bad_comment(p)))
|
&& (!in_vim9script() || !vim9_bad_comment(p)))
|
||||||
{
|
{
|
||||||
if (end_error)
|
if (end_error)
|
||||||
@@ -2807,7 +2805,7 @@ eval1(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
|
|||||||
}
|
}
|
||||||
*arg = skipwhite_and_linebreak(*arg + 1, evalarg_used);
|
*arg = skipwhite_and_linebreak(*arg + 1, evalarg_used);
|
||||||
evalarg_used->eval_flags = (op_falsy ? !result : result)
|
evalarg_used->eval_flags = (op_falsy ? !result : result)
|
||||||
? orig_flags : orig_flags & ~EVAL_EVALUATE;
|
? orig_flags : (orig_flags & ~EVAL_EVALUATE);
|
||||||
if (eval1(arg, &var2, evalarg_used) == FAIL)
|
if (eval1(arg, &var2, evalarg_used) == FAIL)
|
||||||
{
|
{
|
||||||
evalarg_used->eval_flags = orig_flags;
|
evalarg_used->eval_flags = orig_flags;
|
||||||
@@ -2856,7 +2854,7 @@ eval1(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
|
|||||||
}
|
}
|
||||||
*arg = skipwhite_and_linebreak(*arg + 1, evalarg_used);
|
*arg = skipwhite_and_linebreak(*arg + 1, evalarg_used);
|
||||||
evalarg_used->eval_flags = !result ? orig_flags
|
evalarg_used->eval_flags = !result ? orig_flags
|
||||||
: orig_flags & ~EVAL_EVALUATE;
|
: (orig_flags & ~EVAL_EVALUATE);
|
||||||
if (eval1(arg, &var2, evalarg_used) == FAIL)
|
if (eval1(arg, &var2, evalarg_used) == FAIL)
|
||||||
{
|
{
|
||||||
if (evaluate && result)
|
if (evaluate && result)
|
||||||
@@ -2960,7 +2958,7 @@ eval2(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
|
|||||||
}
|
}
|
||||||
*arg = skipwhite_and_linebreak(*arg + 2, evalarg_used);
|
*arg = skipwhite_and_linebreak(*arg + 2, evalarg_used);
|
||||||
evalarg_used->eval_flags = !result ? orig_flags
|
evalarg_used->eval_flags = !result ? orig_flags
|
||||||
: orig_flags & ~EVAL_EVALUATE;
|
: (orig_flags & ~EVAL_EVALUATE);
|
||||||
if (eval3(arg, &var2, evalarg_used) == FAIL)
|
if (eval3(arg, &var2, evalarg_used) == FAIL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
|
||||||
@@ -3086,7 +3084,7 @@ eval3(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
|
|||||||
}
|
}
|
||||||
*arg = skipwhite_and_linebreak(*arg + 2, evalarg_used);
|
*arg = skipwhite_and_linebreak(*arg + 2, evalarg_used);
|
||||||
evalarg_used->eval_flags = result ? orig_flags
|
evalarg_used->eval_flags = result ? orig_flags
|
||||||
: orig_flags & ~EVAL_EVALUATE;
|
: (orig_flags & ~EVAL_EVALUATE);
|
||||||
CLEAR_FIELD(var2);
|
CLEAR_FIELD(var2);
|
||||||
if (eval4(arg, &var2, evalarg_used) == FAIL)
|
if (eval4(arg, &var2, evalarg_used) == FAIL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@@ -4279,8 +4277,6 @@ eval9(
|
|||||||
*arg = skipwhite(*arg);
|
*arg = skipwhite(*arg);
|
||||||
ret = eval_func(arg, evalarg, s, len, rettv, flags, NULL);
|
ret = eval_func(arg, evalarg, s, len, rettv, flags, NULL);
|
||||||
}
|
}
|
||||||
else if (flags & EVAL_CONSTANT)
|
|
||||||
ret = FAIL;
|
|
||||||
else if (evaluate)
|
else if (evaluate)
|
||||||
{
|
{
|
||||||
// get the value of "true", "false", etc. or a variable
|
// get the value of "true", "false", etc. or a variable
|
||||||
|
@@ -2102,9 +2102,8 @@ typedef struct {
|
|||||||
char_u *eval_tofree_lambda;
|
char_u *eval_tofree_lambda;
|
||||||
} evalarg_T;
|
} evalarg_T;
|
||||||
|
|
||||||
// Flags for expression evaluation.
|
// Flag for expression evaluation.
|
||||||
#define EVAL_EVALUATE 1 // when missing don't actually evaluate
|
#define EVAL_EVALUATE 1 // when missing don't actually evaluate
|
||||||
#define EVAL_CONSTANT 2 // when not a constant return FAIL
|
|
||||||
|
|
||||||
# ifdef FEAT_PROFILE
|
# ifdef FEAT_PROFILE
|
||||||
/*
|
/*
|
||||||
|
@@ -695,6 +695,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1452,
|
||||||
/**/
|
/**/
|
||||||
1451,
|
1451,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user