Patch 8.2.0341
Problem:    Using ":for" in Vim9 script gives an error.
Solution:   Pass the LET_NO_COMMAND flag. (closes #5715)
Files:      src/eval.c, src/testdir/test_vim9_script.vim


*** ../vim-8.2.0340/src/eval.c  2020-02-29 17:38:08.866485874 +0100
--- src/eval.c  2020-03-01 16:19:18.561539643 +0100
***************
*** 1491,1496 ****
--- 1491,1498 ----
  {
      forinfo_T *fi = (forinfo_T *)fi_void;
      int               result;
+     int               flag = current_sctx.sc_version == SCRIPT_VERSION_VIM9 ?
+                                                       LET_NO_COMMAND : 0;
      listitem_T        *item;
  
      if (fi->fi_blob != NULL)
***************
*** 1504,1510 ****
        tv.vval.v_number = blob_get(fi->fi_blob, fi->fi_bi);
        ++fi->fi_bi;
        return ex_let_vars(arg, &tv, TRUE, fi->fi_semicolon,
!                                              fi->fi_varcount, 0, NULL) == OK;
      }
  
      item = fi->fi_lw.lw_item;
--- 1506,1512 ----
        tv.vval.v_number = blob_get(fi->fi_blob, fi->fi_bi);
        ++fi->fi_bi;
        return ex_let_vars(arg, &tv, TRUE, fi->fi_semicolon,
!                                      fi->fi_varcount, flag, NULL) == OK;
      }
  
      item = fi->fi_lw.lw_item;
***************
*** 1514,1520 ****
      {
        fi->fi_lw.lw_item = item->li_next;
        result = (ex_let_vars(arg, &item->li_tv, TRUE, fi->fi_semicolon,
!                                         fi->fi_varcount, 0, NULL) == OK);
      }
      return result;
  }
--- 1516,1522 ----
      {
        fi->fi_lw.lw_item = item->li_next;
        result = (ex_let_vars(arg, &item->li_tv, TRUE, fi->fi_semicolon,
!                                     fi->fi_varcount, flag, NULL) == OK);
      }
      return result;
  }
*** ../vim-8.2.0340/src/testdir/test_vim9_script.vim    2020-03-01 
15:36:39.173441814 +0100
--- src/testdir/test_vim9_script.vim    2020-03-01 16:19:18.561539643 +0100
***************
*** 775,779 ****
--- 775,793 ----
    assert_match('^some more$', Screenline(&lines))
  enddef
  
+ def Test_for_outside_of_function()
+   let lines =<< trim END
+     vim9script
+     new
+     for var in range(0, 3)
+       append(line('$'), var)
+     endfor
+     assert_equal(['', '0', '1', '2', '3'], getline(1, '$'))
+     bwipe!
+   END
+   writefile(lines, 'Xvim9for.vim')
+   source Xvim9for.vim
+   delete('Xvim9for.vim')
+ enddef
  
  " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
*** ../vim-8.2.0340/src/version.c       2020-03-01 15:36:39.173441814 +0100
--- src/version.c       2020-03-01 16:22:28.548988404 +0100
***************
*** 740,741 ****
--- 740,743 ----
  {   /* Add new patch number below this line */
+ /**/
+     341,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
148. You find it easier to dial-up the National Weather Service
     Weather/your_town/now.html than to simply look out the window.

 /// 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/202003011523.021FNJC6024754%40masaka.moolenaar.net.

Raspunde prin e-mail lui