Mercurial > vim
comparison src/vim9compile.c @ 23052:9775df18916b v8.2.2072
patch 8.2.2072: Vim9: list assign not well tested
Commit: https://github.com/vim/vim/commit/004d9b00ba600a167746ad7af88e0baa77c95d8f
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Nov 30 21:40:03 2020 +0100
patch 8.2.2072: Vim9: list assign not well tested
Problem: Vim9: list assign not well tested.
Solution: Test with different destinations. Fix white space error.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 30 Nov 2020 21:45:04 +0100 |
parents | b98003d73150 |
children | df0548b649c1 |
comparison
equal
deleted
inserted
replaced
23051:4f0a99b7b4cb | 23052:9775df18916b |
---|---|
5121 | 5121 |
5122 if (var_count > 0 && oplen == 0) | 5122 if (var_count > 0 && oplen == 0) |
5123 // can be something like "[1, 2]->func()" | 5123 // can be something like "[1, 2]->func()" |
5124 return arg; | 5124 return arg; |
5125 | 5125 |
5126 if (oplen > 0 && (!VIM_ISWHITE(*sp) || !VIM_ISWHITE(op[oplen]))) | 5126 if (oplen > 0 && (!VIM_ISWHITE(*sp) || !IS_WHITE_OR_NUL(op[oplen]))) |
5127 { | 5127 { |
5128 error_white_both(op, oplen); | 5128 error_white_both(op, oplen); |
5129 return NULL; | 5129 return NULL; |
5130 } | 5130 } |
5131 | 5131 |
5157 p += STRLEN(p); | 5157 p += STRLEN(p); |
5158 end = p; | 5158 end = p; |
5159 } | 5159 } |
5160 else if (var_count > 0) | 5160 else if (var_count > 0) |
5161 { | 5161 { |
5162 char_u *wp; | |
5163 | |
5162 // for "[var, var] = expr" evaluate the expression here, loop over the | 5164 // for "[var, var] = expr" evaluate the expression here, loop over the |
5163 // list of variables below. | 5165 // list of variables below. |
5164 | 5166 // A line break may follow the "=". |
5165 p = skipwhite(op + oplen); | 5167 |
5168 wp = op + oplen; | |
5169 p = skipwhite(wp); | |
5170 if (may_get_next_line(wp, &p, cctx) == FAIL) | |
5171 return FAIL; | |
5166 if (compile_expr0(&p, cctx) == FAIL) | 5172 if (compile_expr0(&p, cctx) == FAIL) |
5167 return NULL; | 5173 return NULL; |
5168 end = p; | 5174 end = p; |
5169 | 5175 |
5170 if (cctx->ctx_skip != SKIP_YES) | 5176 if (cctx->ctx_skip != SKIP_YES) |