mirror of
https://github.com/vim/vim.git
synced 2025-07-25 10:54:51 -04:00
patch 8.2.1718: Vim9: :def function disallows "firstline" for no good reason
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)
This commit is contained in:
parent
809fcecddc
commit
b816dae16d
@ -486,6 +486,15 @@ def Test_assign_to_argument()
|
|||||||
CheckScriptFailure(['def Func(arg: number)', 'arg = 3', 'enddef', 'defcompile'], 'E1090:')
|
CheckScriptFailure(['def Func(arg: number)', 'arg = 3', 'enddef', 'defcompile'], 'E1090:')
|
||||||
enddef
|
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()
|
def Test_call_func_defined_later()
|
||||||
g:DefinedLater('one')->assert_equal('one')
|
g:DefinedLater('one')->assert_equal('one')
|
||||||
assert_fails('NotDefined("one")', 'E117:', '', 2, 'Test_call_func_defined_later')
|
assert_fails('NotDefined("one")', 'E117:', '', 2, 'Test_call_func_defined_later')
|
||||||
|
@ -66,8 +66,9 @@ one_function_arg(char_u *arg, garray_T *newargs, garray_T *argtypes, int skip)
|
|||||||
while (ASCII_ISALNUM(*p) || *p == '_')
|
while (ASCII_ISALNUM(*p) || *p == '_')
|
||||||
++p;
|
++p;
|
||||||
if (arg == p || isdigit(*arg)
|
if (arg == p || isdigit(*arg)
|
||||||
|| (p - arg == 9 && STRNCMP(arg, "firstline", 9) == 0)
|
|| (argtypes == NULL
|
||||||
|| (p - arg == 8 && STRNCMP(arg, "lastline", 8) == 0))
|
&& ((p - arg == 9 && STRNCMP(arg, "firstline", 9) == 0)
|
||||||
|
|| (p - arg == 8 && STRNCMP(arg, "lastline", 8) == 0))))
|
||||||
{
|
{
|
||||||
if (!skip)
|
if (!skip)
|
||||||
semsg(_("E125: Illegal argument: %s"), arg);
|
semsg(_("E125: Illegal argument: %s"), arg);
|
||||||
|
@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1718,
|
||||||
/**/
|
/**/
|
||||||
1717,
|
1717,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user