Mercurial > vim
diff src/vim9compile.c @ 20949:62912ad41aff v8.2.1026
patch 8.2.1026: Vim9: cannot break the line after "->"
Commit: https://github.com/vim/vim/commit/a3b7fdc1bb227897f41b8f2958a48d0a26292ff7
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jun 21 14:12:17 2020 +0200
patch 8.2.1026: Vim9: cannot break the line after "->"
Problem: Vim9: cannot break the line after "->".
Solution: Check for a continuation line after "->", "[" and ".". Ignore
trailing white space.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 21 Jun 2020 14:15:03 +0200 |
parents | 0653b9b72091 |
children | 6b4b887a12f0 |
line wrap: on
line diff
--- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -3538,7 +3538,10 @@ compile_subscript( return FAIL; *start_leader = end_leader; // don't apply again later - *arg = skipwhite(*arg + 2); + p = *arg + 2; + *arg = skipwhite(p); + if (may_get_next_line(p, arg, cctx) == FAIL) + return FAIL; if (**arg == '{') { // lambda call: list->{lambda} @@ -3567,6 +3570,7 @@ compile_subscript( { garray_T *stack = &cctx->ctx_type_stack; type_T **typep; + char_u *p; // list index: list[123] // dict member: dict[key] @@ -3576,7 +3580,10 @@ compile_subscript( if (generate_ppconst(cctx, ppconst) == FAIL) return FAIL; - *arg = skipwhite(*arg + 1); + p = *arg + 1; + *arg = skipwhite(p); + if (may_get_next_line(p, arg, cctx) == FAIL) + return FAIL; if (compile_expr0(arg, cctx) == FAIL) return FAIL; @@ -3617,8 +3624,10 @@ compile_subscript( return FAIL; ++*arg; + if (may_get_next_line(*arg, arg, cctx) == FAIL) + return FAIL; + // dictionary member: dict.name p = *arg; - // dictionary member: dict.name if (eval_isnamec1(*p)) while (eval_isnamec(*p)) MB_PTR_ADV(p); @@ -6664,7 +6673,7 @@ compile_def_function(ufunc_T *ufunc, int if (line != NULL && *line == '|') // the line continues after a '|' ++line; - else if (line != NULL && *line != NUL + else if (line != NULL && *skipwhite(line) != NUL && !(*line == '#' && (line == cctx.ctx_line_start || VIM_ISWHITE(line[-1])))) {