Patch 9.0.1447
Problem: Condition is always true.
Solution: Remove the useless condition. (closes #12253)
Files: src/evalvars.c
*** ../vim-9.0.1446/src/evalvars.c 2023-03-07 17:13:47.309107774 +0000
--- src/evalvars.c 2023-04-12 21:32:17.133942782 +0100
***************
*** 989,995 ****
char_u *arg = eap->arg;
char_u *expr = NULL;
typval_T rettv;
- int i;
int var_count = 0;
int semicolon = 0;
char_u op[4];
--- 989,994 ----
***************
*** 1067,1074 ****
list_vim_vars(&first);
}
set_nextcmd(eap, arg);
}
! else if (expr[0] == '=' && expr[1] == '<' && expr[2] == '<')
{
list_T *l = NULL;
long cur_lnum = SOURCING_LNUM;
--- 1066,1075 ----
list_vim_vars(&first);
}
set_nextcmd(eap, arg);
+ return;
}
!
! if (expr[0] == '=' && expr[1] == '<' && expr[2] == '<')
{
list_T *l = NULL;
long cur_lnum = SOURCING_LNUM;
***************
*** 1096,1172 ****
}
clear_tv(&rettv);
}
}
- else
- {
- evalarg_T evalarg;
- int len = 1;
! CLEAR_FIELD(rettv);
! i = FAIL;
! if (has_assign || concat)
! {
! int cur_lnum;
! op[0] = '=';
! op[1] = NUL;
! if (*expr != '=')
! {
! if (vim9script && (flags & ASSIGN_NO_DECL) == 0)
! {
! // +=, /=, etc. require an existing variable
! semsg(_(e_cannot_use_operator_on_new_variable_str),
! eap->arg);
! }
! else if (vim_strchr((char_u *)"+-*/%.", *expr) != NULL)
! {
! op[0] = *expr; // +=, -=, *=, /=, %= or .=
! ++len;
! if (expr[0] == '.' && expr[1] == '.') // ..=
! {
! ++expr;
! ++len;
! }
! }
! expr += 2;
! }
! else
! ++expr;
! if (vim9script && !eap->skip && (!VIM_ISWHITE(*argend)
! || !IS_WHITE_OR_NUL(*expr)))
! {
! vim_strncpy(op, expr - len, len);
! semsg(_(e_white_space_required_before_and_after_str_at_str),
! op, argend);
! }
! if (eap->skip)
! ++emsg_skip;
! fill_evalarg_from_eap(&evalarg, eap, eap->skip);
! expr = skipwhite_and_linebreak(expr, &evalarg);
! cur_lnum = SOURCING_LNUM;
! i = eval0(expr, &rettv, eap, &evalarg);
! if (eap->skip)
! --emsg_skip;
! clear_evalarg(&evalarg, eap);
!
! // Restore the line number so that any type error is given for the
! // declaration, not the expression.
! SOURCING_LNUM = cur_lnum;
! }
! if (eap->skip)
{
! if (i != FAIL)
! clear_tv(&rettv);
}
! else if (i != FAIL)
{
! (void)ex_let_vars(eap->arg, &rettv, FALSE, semicolon, var_count,
! flags, op);
! clear_tv(&rettv);
}
}
}
/*
--- 1097,1163 ----
}
clear_tv(&rettv);
}
+ return;
}
! evalarg_T evalarg;
! int len = 1;
! CLEAR_FIELD(rettv);
! int cur_lnum;
! op[0] = '=';
! op[1] = NUL;
! if (*expr != '=')
! {
! if (vim9script && (flags & ASSIGN_NO_DECL) == 0)
{
! // +=, /=, etc. require an existing variable
! semsg(_(e_cannot_use_operator_on_new_variable_str), eap->arg);
}
! else if (vim_strchr((char_u *)"+-*/%.", *expr) != NULL)
{
! op[0] = *expr; // +=, -=, *=, /=, %= or .=
! ++len;
! if (expr[0] == '.' && expr[1] == '.') // ..=
! {
! ++expr;
! ++len;
! }
}
+ expr += 2;
}
+ else
+ ++expr;
+
+ if (vim9script && !eap->skip && (!VIM_ISWHITE(*argend)
+ || !IS_WHITE_OR_NUL(*expr)))
+ {
+ vim_strncpy(op, expr - len, len);
+ semsg(_(e_white_space_required_before_and_after_str_at_str),
+ op, argend);
+ }
+
+ if (eap->skip)
+ ++emsg_skip;
+ fill_evalarg_from_eap(&evalarg, eap, eap->skip);
+ expr = skipwhite_and_linebreak(expr, &evalarg);
+ cur_lnum = SOURCING_LNUM;
+ int eval_res = eval0(expr, &rettv, eap, &evalarg);
+ if (eap->skip)
+ --emsg_skip;
+ clear_evalarg(&evalarg, eap);
+
+ // Restore the line number so that any type error is given for the
+ // declaration, not the expression.
+ SOURCING_LNUM = cur_lnum;
+
+ if (!eap->skip && eval_res != FAIL)
+ (void)ex_let_vars(eap->arg, &rettv, FALSE, semicolon, var_count,
+ flags, op);
+ if (eval_res != FAIL)
+ clear_tv(&rettv);
}
/*
*** ../vim-9.0.1446/src/version.c 2023-04-12 20:48:09.335718024 +0100
--- src/version.c 2023-04-12 21:33:19.161982874 +0100
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 1447,
/**/
--
ARTHUR: Charge!
[They all charge with swords drawn towards the RABBIT. A tremendous twenty
second fight with Peckinpahish shots and borrowing heavily also on the
Kung Fu and karate-type films ensues, in which some four KNIGHTS are
comprehensively killed.]
ARTHUR: Run away! Run away!
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20230412203646.8435B1C0F2A%40moolenaar.net.