Patch 8.2.2079
Problem:    Vim9: cannot put a linebreak before or after "in" of ":for".
Solution:   Skip over linebreak.
Files:      src/vim9compile.c, src/testdir/test_vim9_script.vim


*** ../vim-8.2.2078/src/vim9compile.c   2020-12-01 16:30:40.161598319 +0100
--- src/vim9compile.c   2020-12-02 13:21:41.398032324 +0100
***************
*** 6486,6491 ****
--- 6486,6492 ----
      char_u    *arg_end;
      char_u    *name = NULL;
      char_u    *p;
+     char_u    *wp;
      int               var_count = 0;
      int               semicolon = FALSE;
      size_t    varlen;
***************
*** 6503,6515 ****
        var_count = 1;
  
      // consume "in"
      p = skipwhite(p);
!     if (STRNCMP(p, "in", 2) != 0 || !VIM_ISWHITE(p[2]))
      {
        emsg(_(e_missing_in));
        return NULL;
      }
!     p = skipwhite(p + 2);
  
      scope = new_scope(cctx, FOR_SCOPE);
      if (scope == NULL)
--- 6504,6522 ----
        var_count = 1;
  
      // consume "in"
+     wp = p;
      p = skipwhite(p);
!     if (may_get_next_line_error(wp, &p, cctx) == FAIL)
!       return NULL;
!     if (STRNCMP(p, "in", 2) != 0 || !IS_WHITE_OR_NUL(p[2]))
      {
        emsg(_(e_missing_in));
        return NULL;
      }
!     wp = p + 2;
!     p = skipwhite(wp);
!     if (may_get_next_line_error(wp, &p, cctx) == FAIL)
!       return NULL;
  
      scope = new_scope(cctx, FOR_SCOPE);
      if (scope == NULL)
*** ../vim-8.2.2078/src/testdir/test_vim9_script.vim    2020-12-01 
20:12:20.792108768 +0100
--- src/testdir/test_vim9_script.vim    2020-12-02 13:22:43.557822962 +0100
***************
*** 1849,1854 ****
--- 1849,1876 ----
      concat ..= str
    endfor
    assert_equal('onetwo', concat)
+ 
+   var total = 0
+   for nr in
+       [1, 2, 3]
+     total += nr
+   endfor
+   assert_equal(6, total)
+ 
+   total = 0
+   for nr
+     in [1, 2, 3]
+     total += nr
+   endfor
+   assert_equal(6, total)
+ 
+   total = 0
+   for nr
+     in
+     [1, 2, 3]
+     total += nr
+   endfor
+   assert_equal(6, total)
  enddef
  
  def Test_for_loop_fails()
*** ../vim-8.2.2078/src/version.c       2020-12-02 12:37:34.130954024 +0100
--- src/version.c       2020-12-02 13:08:59.020660152 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2079,
  /**/

-- 
There are three kinds of people: Those who can count & those who can't.

 /// 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/202012021224.0B2CO8x64111558%40masaka.moolenaar.net.

Raspunde prin e-mail lui