Mercurial > vim
diff src/vim9compile.c @ 21455:8cc1555f2445 v8.2.1278
patch 8.2.1278: Vim9: line break after "->" only allowed in :def function
Commit: https://github.com/vim/vim/commit/dd1a9af00f6954b176c5875af0a91acde72572c8
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jul 23 15:38:03 2020 +0200
patch 8.2.1278: Vim9: line break after "->" only allowed in :def function
Problem: Vim9: line break after "->" only allowed in :def function.
Solution: Only allow line break after "->". (closes https://github.com/vim/vim/issues/6492)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 23 Jul 2020 15:45:06 +0200 |
parents | 66386ca8a69f |
children | 7f36d36f7195 |
line wrap: on
line diff
--- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -3773,8 +3773,7 @@ compile_subscript( p += 2; *arg = skipwhite(p); - if (may_get_next_line(p, arg, cctx) == FAIL) - return FAIL; + // No line break supported right after "->". if (**arg == '{') { // lambda call: list->{lambda} @@ -3785,6 +3784,11 @@ compile_subscript( { // method call: list->method() p = *arg; + if (!eval_isnamec1(*p)) + { + semsg(_(e_trailing_arg), p); + return FAIL; + } if (ASCII_ISALPHA(*p) && p[1] == ':') p += 2; for ( ; eval_isnamec1(*p); ++p) @@ -7045,7 +7049,7 @@ compile_def_function(ufunc_T *ufunc, int && !(*line == '#' && (line == cctx.ctx_line_start || VIM_ISWHITE(line[-1])))) { - semsg(_("E488: Trailing characters: %s"), line); + semsg(_(e_trailing_arg), line); goto erret; } else