Patch 9.0.1239
Problem:    Cannot have a line break before an object member access.
Solution:   Check for "." in next line. (closes #11864)
Files:      src/eval.c, src/testdir/test_vim9_class.vim


*** ../vim-9.0.1238/src/eval.c  2023-01-11 19:11:09.468757611 +0000
--- src/eval.c  2023-01-24 12:59:22.531029261 +0000
***************
*** 6747,6753 ****
        // the next line then consume the line break.
        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])))))
--- 6747,6756 ----
        // the next line then consume the line break.
        p = eval_next_non_blank(*arg, evalarg, &getnext);
        if (getnext
!           && ((*p == '.'
!                   && ((rettv->v_type == VAR_DICT && eval_isdictc(p[1]))
!                       || rettv->v_type == VAR_CLASS
!                       || rettv->v_type == VAR_OBJECT))
                || (p[0] == '-' && p[1] == '>' && (p[2] == '{'
                        || ASCII_ISALPHA(in_vim9script() ? *skipwhite(p + 2)
                                                                    : p[2])))))
*** ../vim-9.0.1238/src/testdir/test_vim9_class.vim     2023-01-18 
14:51:03.771305354 +0000
--- src/testdir/test_vim9_class.vim     2023-01-24 13:02:50.767105858 +0000
***************
*** 439,444 ****
--- 439,470 ----
        var c = MyCar.new("def")
    END
    v9.CheckScriptFailure(lines, 'E1041:')
+ 
+   lines =<< trim END
+       vim9script
+ 
+       class Foo
+         this.x: list<number> = []
+ 
+         def Add(n: number): any
+           this.x->add(n)
+           return this
+         enddef
+       endclass
+ 
+       echo Foo.new().Add(1).Add(2).x
+       echo Foo.new().Add(1).Add(2)
+             .x
+       echo Foo.new().Add(1)
+             .Add(2).x
+       echo Foo.new()
+             .Add(1).Add(2).x
+       echo Foo.new()
+             .Add(1) 
+             .Add(2)
+             .x
+   END
+   v9.CheckScriptSuccess(lines)
  enddef
  
  def Test_class_object_compare()
*** ../vim-9.0.1238/src/version.c       2023-01-24 12:33:58.950777425 +0000
--- src/version.c       2023-01-24 13:03:09.147109936 +0000
***************
*** 697,698 ****
--- 697,700 ----
  {   /* Add new patch number below this line */
+ /**/
+     1239,
  /**/

-- 
I started out with nothing, and I still have most of it.
                                -- Michael Davis -- "Tonight Show"

 /// Bram Moolenaar -- b...@moolenaar.net -- 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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20230124130410.9B16C1C08EE%40moolenaar.net.

Raspunde prin e-mail lui