Patch 8.2.1175
Problem: Vim9: Cannot split a line before ".member".
Solution: Check for ".member" after line break.
Files: src/vim9compile.c, src/testdir/test_vim9_expr.vim
*** ../vim-8.2.1174/src/vim9compile.c 2020-07-09 21:20:41.908126834 +0200
--- src/vim9compile.c 2020-07-10 21:48:59.161041528 +0200
***************
*** 2501,2506 ****
--- 2501,2521 ----
return OK;
}
+ /*
+ * Idem, and give an error when failed.
+ */
+ static int
+ may_get_next_line_error(char_u *whitep, char_u **arg, cctx_T *cctx)
+ {
+ if (may_get_next_line(whitep, arg, cctx) == FAIL)
+ {
+ emsg(_("E1097: line incomplete"));
+ return FAIL;
+ }
+ return OK;
+ }
+
+
// Structure passed between the compile_expr* functions to keep track of
// constants that have been parsed but for which no code was produced yet. If
// possible expressions on these constants are applied at compile time. If
***************
*** 3588,3595 ****
// If a following line starts with "->{" or "->X" advance to that
// line, so that a line break before "->" is allowed.
! if (next != NULL && next[0] == '-' && next[1] == '>'
! && (next[2] == '{' || ASCII_ISALPHA(next[2])))
{
next = next_line_from_context(cctx, TRUE);
if (next == NULL)
--- 3603,3613 ----
// If a following line starts with "->{" or "->X" advance to that
// line, so that a line break before "->" is allowed.
! // Also if a following line starts with ".x".
! if (next != NULL &&
! ((next[0] == '-' && next[1] == '>'
! && (next[2] == '{' || ASCII_ISALPHA(next[2])))
! || (next[0] == '.' && ASCII_ISALPHA(next[1]))))
{
next = next_line_from_context(cctx, TRUE);
if (next == NULL)
***************
*** 3672,3682 ****
++p;
*arg = skipwhite(p);
! if (may_get_next_line(p, arg, cctx) == FAIL)
return FAIL;
if (compile_expr0(arg, cctx) == FAIL)
return FAIL;
if (**arg != ']')
{
emsg(_(e_missbrac));
--- 3690,3702 ----
++p;
*arg = skipwhite(p);
! if (may_get_next_line_error(p, arg, cctx) == FAIL)
return FAIL;
if (compile_expr0(arg, cctx) == FAIL)
return FAIL;
+ if (may_get_next_line_error(p, arg, cctx) == FAIL)
+ return FAIL;
if (**arg != ']')
{
emsg(_(e_missbrac));
*** ../vim-8.2.1174/src/testdir/test_vim9_expr.vim 2020-07-09 21:20:41.912126818 +0200
--- src/testdir/test_vim9_expr.vim 2020-07-10 21:49:24.264968794 +0200
***************
*** 1016,1022 ****
call CheckDefFailure(["let x = g:list_mixed[xxx]"], 'E1001:')
call CheckDefFailure(["let x = [1,2,3]"], 'E1069:')
call CheckDefExecFailure(["let x = g:list_mixed['xx']"], 'E39:')
! call CheckDefFailure(["let x = g:list_mixed[0"], 'E111:')
call CheckDefExecFailure(["let x = g:list_empty[3]"], 'E684:')
enddef
--- 1016,1023 ----
call CheckDefFailure(["let x = g:list_mixed[xxx]"], 'E1001:')
call CheckDefFailure(["let x = [1,2,3]"], 'E1069:')
call CheckDefExecFailure(["let x = g:list_mixed['xx']"], 'E39:')
! call CheckDefFailure(["let x = g:list_mixed["], 'E1097:')
! call CheckDefFailure(["let x = g:list_mixed[0"], 'E1097:')
call CheckDefExecFailure(["let x = g:list_empty[3]"], 'E684:')
enddef
***************
*** 1135,1140 ****
--- 1136,1146 ----
assert_equal(1, g:dict_one.one)
let d: dict<number> = g:dict_one
assert_equal(1, d['one'])
+ assert_equal(1, d[
+ 'one'
+ ])
+ assert_equal(1, d
+ .one)
# getting the one member should clear the dict after getting the item
assert_equal('one', #{one: 'one'}.one)
*** ../vim-8.2.1174/src/version.c 2020-07-10 21:17:47.792406306 +0200
--- src/version.c 2020-07-10 21:50:13.680868948 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1175,
/**/
--
A)bort, R)etry, D)o it right this time
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language --
http://www.Zimbu.org ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///