comparison src/vim9compile.c @ 23070:6a70803f4cbe v8.2.2081

patch 8.2.2081: Vim9: cannot handle a linebreak after "=" in assignment Commit: https://github.com/vim/vim/commit/7f76494aac512b1d603d9be4132184241f43872c Author: Bram Moolenaar <Bram@vim.org> Date: Wed Dec 2 15:11:18 2020 +0100 patch 8.2.2081: Vim9: cannot handle a linebreak after "=" in assignment Problem: Vim9: cannot handle a linebreak after "=" in assignment. Solution: Skip over linebreak. (closes https://github.com/vim/vim/issues/7407)
author Bram Moolenaar <Bram@vim.org>
date Wed, 02 Dec 2020 15:15:05 +0100
parents 2f034cb0a046
children 4b398a229b0b
comparison
equal deleted inserted replaced
23069:fae4ecfc2653 23070:6a70803f4cbe
5668 } 5668 }
5669 } 5669 }
5670 else if (oplen > 0) 5670 else if (oplen > 0)
5671 { 5671 {
5672 int is_const = FALSE; 5672 int is_const = FALSE;
5673 char_u *wp;
5673 5674
5674 // For "var = expr" evaluate the expression. 5675 // For "var = expr" evaluate the expression.
5675 if (var_count == 0) 5676 if (var_count == 0)
5676 { 5677 {
5677 int r; 5678 int r;
5692 // Compile the expression. Temporarily hide the new local 5693 // Compile the expression. Temporarily hide the new local
5693 // variable here, it is not available to this expression. 5694 // variable here, it is not available to this expression.
5694 if (new_local) 5695 if (new_local)
5695 --cctx->ctx_locals.ga_len; 5696 --cctx->ctx_locals.ga_len;
5696 instr_count = instr->ga_len; 5697 instr_count = instr->ga_len;
5697 p = skipwhite(op + oplen); 5698 wp = op + oplen;
5699 p = skipwhite(wp);
5700 if (may_get_next_line_error(wp, &p, cctx) == FAIL)
5701 goto theend;
5698 r = compile_expr0_ext(&p, cctx, &is_const); 5702 r = compile_expr0_ext(&p, cctx, &is_const);
5699 if (new_local) 5703 if (new_local)
5700 ++cctx->ctx_locals.ga_len; 5704 ++cctx->ctx_locals.ga_len;
5701 if (r == FAIL) 5705 if (r == FAIL)
5702 goto theend; 5706 goto theend;
5710 else 5714 else
5711 { 5715 {
5712 // For "[var, var] = expr" get the "var_idx" item from the 5716 // For "[var, var] = expr" get the "var_idx" item from the
5713 // list. 5717 // list.
5714 if (generate_GETITEM(cctx, var_idx) == FAIL) 5718 if (generate_GETITEM(cctx, var_idx) == FAIL)
5715 return FAIL; 5719 goto theend;
5716 } 5720 }
5717 5721
5718 rhs_type = stack->ga_len == 0 ? &t_void 5722 rhs_type = stack->ga_len == 0 ? &t_void
5719 : ((type_T **)stack->ga_data)[stack->ga_len - 1]; 5723 : ((type_T **)stack->ga_data)[stack->ga_len - 1];
5720 if (lvar != NULL && (is_decl || !has_type)) 5724 if (lvar != NULL && (is_decl || !has_type))