Patch 8.2.1718
Problem: Vim9: :def function disallows "firstline" and "lastline" argument
names for no good reason.
Solution: Don't check the arguments for a :def function. (closes #6986)
Files: src/userfunc.c, src/testdir/test_vim9_func.vim
*** ../vim-8.2.1717/src/userfunc.c 2020-09-19 18:19:15.667278827 +0200
--- src/userfunc.c 2020-09-20 22:02:11.221962262 +0200
***************
*** 66,73 ****
while (ASCII_ISALNUM(*p) || *p == '_')
++p;
if (arg == p || isdigit(*arg)
! || (p - arg == 9 && STRNCMP(arg, "firstline", 9) == 0)
! || (p - arg == 8 && STRNCMP(arg, "lastline", 8) == 0))
{
if (!skip)
semsg(_("E125: Illegal argument: %s"), arg);
--- 66,74 ----
while (ASCII_ISALNUM(*p) || *p == '_')
++p;
if (arg == p || isdigit(*arg)
! || (argtypes == NULL
! && ((p - arg == 9 && STRNCMP(arg, "firstline", 9) == 0)
! || (p - arg == 8 && STRNCMP(arg, "lastline", 8) == 0))))
{
if (!skip)
semsg(_("E125: Illegal argument: %s"), arg);
*** ../vim-8.2.1717/src/testdir/test_vim9_func.vim 2020-09-18
22:41:56.608975426 +0200
--- src/testdir/test_vim9_func.vim 2020-09-20 22:01:30.734144974 +0200
***************
*** 486,491 ****
--- 486,500 ----
CheckScriptFailure(['def Func(arg: number)', 'arg = 3', 'enddef',
'defcompile'], 'E1090:')
enddef
+ " These argument names are reserved in legacy functions.
+ def WithReservedNames(firstline: string, lastline: string): string
+ return firstline .. lastline
+ enddef
+
+ def Test_argument_names()
+ assert_equal('OK', WithReservedNames('O', 'K'))
+ enddef
+
def Test_call_func_defined_later()
g:DefinedLater('one')->assert_equal('one')
assert_fails('NotDefined("one")', 'E117:', '', 2,
'Test_call_func_defined_later')
*** ../vim-8.2.1717/src/version.c 2020-09-20 21:42:40.391206450 +0200
--- src/version.c 2020-09-20 21:58:40.894890394 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 1718,
/**/
--
ARTHUR: I've said I'm sorry about the old woman, but from the behind you
looked ...
DENNIS: What I object to is that you automatically treat me like an inferior...
ARTHUR: Well ... I AM king.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// 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/202009202004.08KK4cLQ3232927%40masaka.moolenaar.net.