0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.2.0485: Vim9 script test fails

Problem:    Vim9 script test fails.
Solution:   Stricter condition for adding new local variable.
This commit is contained in:
Bram Moolenaar 2020-03-30 21:28:39 +02:00
parent 92dba36fc8
commit 01b3862956
2 changed files with 6 additions and 2 deletions

View File

@ -738,6 +738,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
485,
/**/
484,
/**/

View File

@ -3446,6 +3446,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
size_t varlen;
garray_T *instr = &cctx->ctx_instr;
int idx = -1;
int new_local = FALSE;
char_u *op;
int opt_type;
assign_dest_T dest = dest_local;
@ -3660,6 +3661,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
idx = reserve_local(cctx, arg, varlen, cmdidx == CMD_const, type);
if (idx < 0)
goto theend;
new_local = TRUE;
}
if (heredoc)
@ -3721,12 +3723,12 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
// Compile the expression. Temporarily hide the new local variable
// here, it is not available to this expression.
if (idx >= 0)
if (new_local)
--cctx->ctx_locals.ga_len;
instr_count = instr->ga_len;
p = skipwhite(p + oplen);
r = compile_expr1(&p, cctx);
if (idx >= 0)
if (new_local)
++cctx->ctx_locals.ga_len;
if (r == FAIL)
goto theend;