forked from aniani/vim
patch 9.0.1447: condition is always true
Problem: Condition is always true. Solution: Remove the useless condition. (closes #12253)
This commit is contained in:
@@ -989,7 +989,6 @@ ex_let(exarg_T *eap)
|
|||||||
char_u *arg = eap->arg;
|
char_u *arg = eap->arg;
|
||||||
char_u *expr = NULL;
|
char_u *expr = NULL;
|
||||||
typval_T rettv;
|
typval_T rettv;
|
||||||
int i;
|
|
||||||
int var_count = 0;
|
int var_count = 0;
|
||||||
int semicolon = 0;
|
int semicolon = 0;
|
||||||
char_u op[4];
|
char_u op[4];
|
||||||
@@ -1067,8 +1066,10 @@ ex_let(exarg_T *eap)
|
|||||||
list_vim_vars(&first);
|
list_vim_vars(&first);
|
||||||
}
|
}
|
||||||
set_nextcmd(eap, arg);
|
set_nextcmd(eap, arg);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (expr[0] == '=' && expr[1] == '<' && expr[2] == '<')
|
|
||||||
|
if (expr[0] == '=' && expr[1] == '<' && expr[2] == '<')
|
||||||
{
|
{
|
||||||
list_T *l = NULL;
|
list_T *l = NULL;
|
||||||
long cur_lnum = SOURCING_LNUM;
|
long cur_lnum = SOURCING_LNUM;
|
||||||
@@ -1096,16 +1097,14 @@ ex_let(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
clear_tv(&rettv);
|
clear_tv(&rettv);
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
evalarg_T evalarg;
|
evalarg_T evalarg;
|
||||||
int len = 1;
|
int len = 1;
|
||||||
|
|
||||||
CLEAR_FIELD(rettv);
|
CLEAR_FIELD(rettv);
|
||||||
i = FAIL;
|
|
||||||
if (has_assign || concat)
|
|
||||||
{
|
|
||||||
int cur_lnum;
|
int cur_lnum;
|
||||||
|
|
||||||
op[0] = '=';
|
op[0] = '=';
|
||||||
@@ -1115,8 +1114,7 @@ ex_let(exarg_T *eap)
|
|||||||
if (vim9script && (flags & ASSIGN_NO_DECL) == 0)
|
if (vim9script && (flags & ASSIGN_NO_DECL) == 0)
|
||||||
{
|
{
|
||||||
// +=, /=, etc. require an existing variable
|
// +=, /=, etc. require an existing variable
|
||||||
semsg(_(e_cannot_use_operator_on_new_variable_str),
|
semsg(_(e_cannot_use_operator_on_new_variable_str), eap->arg);
|
||||||
eap->arg);
|
|
||||||
}
|
}
|
||||||
else if (vim_strchr((char_u *)"+-*/%.", *expr) != NULL)
|
else if (vim_strchr((char_u *)"+-*/%.", *expr) != NULL)
|
||||||
{
|
{
|
||||||
@@ -1146,7 +1144,7 @@ ex_let(exarg_T *eap)
|
|||||||
fill_evalarg_from_eap(&evalarg, eap, eap->skip);
|
fill_evalarg_from_eap(&evalarg, eap, eap->skip);
|
||||||
expr = skipwhite_and_linebreak(expr, &evalarg);
|
expr = skipwhite_and_linebreak(expr, &evalarg);
|
||||||
cur_lnum = SOURCING_LNUM;
|
cur_lnum = SOURCING_LNUM;
|
||||||
i = eval0(expr, &rettv, eap, &evalarg);
|
int eval_res = eval0(expr, &rettv, eap, &evalarg);
|
||||||
if (eap->skip)
|
if (eap->skip)
|
||||||
--emsg_skip;
|
--emsg_skip;
|
||||||
clear_evalarg(&evalarg, eap);
|
clear_evalarg(&evalarg, eap);
|
||||||
@@ -1154,20 +1152,13 @@ ex_let(exarg_T *eap)
|
|||||||
// Restore the line number so that any type error is given for the
|
// Restore the line number so that any type error is given for the
|
||||||
// declaration, not the expression.
|
// declaration, not the expression.
|
||||||
SOURCING_LNUM = cur_lnum;
|
SOURCING_LNUM = cur_lnum;
|
||||||
}
|
|
||||||
if (eap->skip)
|
if (!eap->skip && eval_res != FAIL)
|
||||||
{
|
|
||||||
if (i != FAIL)
|
|
||||||
clear_tv(&rettv);
|
|
||||||
}
|
|
||||||
else if (i != FAIL)
|
|
||||||
{
|
|
||||||
(void)ex_let_vars(eap->arg, &rettv, FALSE, semicolon, var_count,
|
(void)ex_let_vars(eap->arg, &rettv, FALSE, semicolon, var_count,
|
||||||
flags, op);
|
flags, op);
|
||||||
|
if (eval_res != FAIL)
|
||||||
clear_tv(&rettv);
|
clear_tv(&rettv);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Assign the typeval "tv" to the variable or variables at "arg_start".
|
* Assign the typeval "tv" to the variable or variables at "arg_start".
|
||||||
|
@@ -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 */
|
||||||
|
/**/
|
||||||
|
1447,
|
||||||
/**/
|
/**/
|
||||||
1446,
|
1446,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user