Patch 8.2.2964
Problem: Vim9: hang when using space after ->. (Naohiro Ono)
Solution: Skip over white space to find the function name. (closes #8341)
Files: src/eval.c, src/vim9compile.c, src/testdir/test_vim9_expr.vim
*** ../vim-8.2.2963/src/eval.c 2021-06-06 12:07:51.006887010 +0200
--- src/eval.c 2021-06-08 20:30:57.540839186 +0200
***************
*** 5786,5793 ****
p = eval_next_non_blank(*arg, evalarg, &getnext);
if (getnext
&& ((rettv->v_type == VAR_DICT && *p == '.' && eval_isdictc(p[1]))
! || (p[0] == '-' && p[1] == '>'
! && (p[2] == '{' || ASCII_ISALPHA(p[2])))))
{
*arg = eval_next_line(evalarg);
p = *arg;
--- 5786,5794 ----
p = eval_next_non_blank(*arg, evalarg, &getnext);
if (getnext
&& ((rettv->v_type == VAR_DICT && *p == '.' && eval_isdictc(p[1]))
! || (p[0] == '-' && p[1] == '>' && (p[2] == '{'
! || ASCII_ISALPHA(in_vim9script() ? *skipwhite(p + 2)
! : p[2])))))
{
*arg = eval_next_line(evalarg);
p = *arg;
*** ../vim-8.2.2963/src/vim9compile.c 2021-06-06 21:38:04.937344599 +0200
--- src/vim9compile.c 2021-06-08 20:37:05.299936683 +0200
***************
*** 4108,4114 ****
// Also if a following line starts with ".x".
if (next != NULL &&
((next[0] == '-' && next[1] == '>'
! && (next[2] == '{' || ASCII_ISALPHA(next[2])))
|| (next[0] == '.' && eval_isdictc(next[1]))))
{
next = next_line_from_context(cctx, TRUE);
--- 4108,4115 ----
// Also if a following line starts with ".x".
if (next != NULL &&
((next[0] == '-' && next[1] == '>'
! && (next[2] == '{'
! || ASCII_ISALPHA(*skipwhite(next + 2))))
|| (next[0] == '.' && eval_isdictc(next[1]))))
{
next = next_line_from_context(cctx, TRUE);
*** ../vim-8.2.2963/src/testdir/test_vim9_expr.vim 2021-06-04
21:00:27.958234335 +0200
--- src/testdir/test_vim9_expr.vim 2021-06-08 20:34:46.544271553 +0200
***************
*** 2961,2966 ****
--- 2961,2970 ----
var Join = (l) => join(l, 'x')
assert_equal('axb', ['a', 'b']->(Join)())
+
+ var sorted = [3, 1, 2]
+ -> sort()
+ assert_equal([1, 2, 3], sorted)
END
CheckDefAndScriptSuccess(lines)
enddef
*** ../vim-8.2.2963/src/version.c 2021-06-08 20:13:27.363916582 +0200
--- src/version.c 2021-06-08 20:32:40.736580700 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2964,
/**/
--
There are two ways of constructing a software design. One way is to make
it so simple that there are obviously no deficiencies. The other way
is to make it so complicated that there are no obvious deficiencies.
-C.A.R. Hoare
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ 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/202106081847.158Ilesm911912%40masaka.moolenaar.net.