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)
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
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 4871,
/**/
4870,
/**/
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)