Patch 8.2.4871
Problem:    Vim9: in :def function no error for using a range with a command
            that does not accept one.
Solution:   Check for the command to accept a range. (closes #10330)
Files:      src/vim9compile.c, src/testdir/test_vim9_script.vim


*** ../vim-8.2.4870/src/vim9compile.c   2022-05-04 16:46:51.349318219 +0100
--- src/vim9compile.c   2022-05-05 15:12:42.244172341 +0100
***************
*** 3080,3085 ****
--- 3080,3090 ----
                ea.forceit = TRUE;
                p = skipwhite(p + 1);
            }
+           if ((ea.argt & EX_RANGE) == 0 && ea.addr_count > 0)
+           {
+               emsg(_(e_no_range_allowed));
+               goto erret;
+           }
        }
  
        switch (ea.cmdidx)
*** ../vim-8.2.4870/src/testdir/test_vim9_script.vim    2022-05-04 
17:29:07.767382639 +0100
--- src/testdir/test_vim9_script.vim    2022-05-05 15:18:59.359842202 +0100
***************
*** 67,72 ****
--- 67,95 ----
    endif
  enddef
  
+ def Test_invalid_range()
+   var lines =<< trim END
+       :123 eval 1 + 2
+   END
+   v9.CheckDefAndScriptFailure(lines, 'E481:', 1)
+ 
+   lines =<< trim END
+       :123 if true
+       endif
+   END
+   v9.CheckDefAndScriptFailure(lines, 'E481:', 1)
+ 
+   lines =<< trim END
+       :123 echo 'yes'
+   END
+   v9.CheckDefAndScriptFailure(lines, 'E481:', 1)
+ 
+   lines =<< trim END
+       :123 cd there
+   END
+   v9.CheckDefAndScriptFailure(lines, 'E481:', 1)
+ enddef
+ 
  let g:alist = [7]
  let g:astring = 'text'
  let g:anumber = 123
*** ../vim-8.2.4870/src/version.c       2022-05-05 13:52:59.416192105 +0100
--- src/version.c       2022-05-05 15:14:14.712091509 +0100
***************
*** 748,749 ****
--- 748,751 ----
  {   /* Add new patch number below this line */
+ /**/
+     4871,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
100. The most exciting sporting events you noticed during summer 1996
    was Netscape vs. Microsoft.

 /// 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/20220505142235.4345A1C0100%40moolenaar.net.

Raspunde prin e-mail lui