0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.1301: Vim9: varargs argument type not parsed properly

Problem:    Vim9: varargs argument type not parsed properly.
Solution:   Skip over the "...". (issue #6507)
This commit is contained in:
Bram Moolenaar
2020-07-26 18:16:58 +02:00
parent 4fc224ca1c
commit ace6132aa8
3 changed files with 17 additions and 0 deletions

View File

@@ -363,6 +363,19 @@ def Test_call_funcref()
assert_equal(123, g:echo) assert_equal(123, g:echo)
END END
CheckScriptSuccess(lines) CheckScriptSuccess(lines)
lines =<< trim END
vim9script
def EchoList(...l: list<number>)
g:echo = l
enddef
let Funcref: func(...list<number>) = function('EchoList')
Funcref()
assert_equal([], g:echo)
Funcref(1, 2, 3)
assert_equal([1, 2, 3], g:echo)
END
CheckScriptSuccess(lines)
enddef enddef
let SomeFunc = function('len') let SomeFunc = function('len')

View File

@@ -754,6 +754,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 */
/**/
1301,
/**/ /**/
1300, 1300,
/**/ /**/

View File

@@ -1956,6 +1956,8 @@ skip_type(char_u *start, int optional)
{ {
char_u *sp = p; char_u *sp = p;
if (STRNCMP(p, "...", 3) == 0)
p += 3;
p = skip_type(p, TRUE); p = skip_type(p, TRUE);
if (p == sp) if (p == sp)
return p; // syntax error return p; // syntax error