Patch 8.1.2262
Problem: Unpack assignment in function not recognized.
Solution: Skip over "[a, b]". (closes #5051)
Files: src/userfunc.c, src/testdir/test_let.vim
*** ../vim-8.1.2261/src/userfunc.c 2019-10-09 22:52:49.000043746 +0200
--- src/userfunc.c 2019-11-06 14:54:33.598962137 +0100
***************
*** 2482,2506 ****
}
// Check for ":let v =<< [trim] EOF"
arg = skipwhite(skiptowhite(p));
! arg = skipwhite(skiptowhite(arg));
! if (arg[0] == '=' && arg[1] == '<' && arg[2] =='<'
! && ((p[0] == 'l'
! && p[1] == 'e'
! && (!ASCII_ISALNUM(p[2])
! || (p[2] == 't' && !ASCII_ISALNUM(p[3]))))))
{
! p = skipwhite(arg + 3);
! if (STRNCMP(p, "trim", 4) == 0)
{
! // Ignore leading white space.
! p = skipwhite(p + 4);
! heredoc_trimmed = vim_strnsave(theline,
(int)(skipwhite(theline) - theline));
}
- skip_until = vim_strnsave(p, (int)(skiptowhite(p) - p));
- do_concat = FALSE;
- is_heredoc = TRUE;
}
}
--- 2482,2512 ----
}
// Check for ":let v =<< [trim] EOF"
+ // and ":let [a, b] =<< [trim] EOF"
arg = skipwhite(skiptowhite(p));
! if (*arg == '[')
! arg = vim_strchr(arg, ']');
! if (arg != NULL)
{
! arg = skipwhite(skiptowhite(arg));
! if ( arg[0] == '=' && arg[1] == '<' && arg[2] =='<'
! && ((p[0] == 'l'
! && p[1] == 'e'
! && (!ASCII_ISALNUM(p[2])
! || (p[2] == 't' && !ASCII_ISALNUM(p[3]))))))
{
! p = skipwhite(arg + 3);
! if (STRNCMP(p, "trim", 4) == 0)
! {
! // Ignore leading white space.
! p = skipwhite(p + 4);
! heredoc_trimmed = vim_strnsave(theline,
(int)(skipwhite(theline) - theline));
+ }
+ skip_until = vim_strnsave(p, (int)(skiptowhite(p) - p));
+ do_concat = FALSE;
+ is_heredoc = TRUE;
}
}
}
*** ../vim-8.1.2261/src/testdir/test_let.vim 2019-10-16 23:34:38.614482577
+0200
--- src/testdir/test_let.vim 2019-11-06 15:00:34.057681588 +0100
***************
*** 303,306 ****
--- 303,314 ----
END
endif
call assert_equal([], check)
+
+ " unpack assignment
+ let [a, b, c] =<< END
+ x
+ \y
+ z
+ END
+ call assert_equal([' x', ' \y', ' z'], [a, b, c])
endfunc
*** ../vim-8.1.2261/src/version.c 2019-11-06 13:59:12.938333167 +0100
--- src/version.c 2019-11-06 15:01:55.441385018 +0100
***************
*** 743,744 ****
--- 743,746 ----
{ /* Add new patch number below this line */
+ /**/
+ 2262,
/**/
--
He who laughs last, thinks slowest.
/// Bram Moolenaar -- [email protected] -- 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 ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/201911061403.xA6E3IpM017547%40masaka.moolenaar.net.