forked from aniani/vim
patch 8.2.2371: Vim9: crash when using types in :for with unpack
Problem: Vim9: crash when using types in :for with unpack. Solution: Check for skip_var_list() failing. Pass include_type to skip_var_one(). Skip type when compiling. (closes #7694)
This commit is contained in:
@@ -1019,7 +1019,7 @@ skip_var_list(
|
||||
for (;;)
|
||||
{
|
||||
p = skipwhite(p + 1); // skip whites after '[', ';' or ','
|
||||
s = skip_var_one(p, FALSE);
|
||||
s = skip_var_one(p, include_type);
|
||||
if (s == p)
|
||||
{
|
||||
if (!silent)
|
||||
@@ -1067,11 +1067,14 @@ skip_var_one(char_u *arg, int include_type)
|
||||
return arg + 2;
|
||||
end = find_name_end(*arg == '$' || *arg == '&' ? arg + 1 : arg,
|
||||
NULL, NULL, FNE_INCL_BR | FNE_CHECK_START);
|
||||
|
||||
// "a: type" is declaring variable "a" with a type, not "a:".
|
||||
// Same for "s: type".
|
||||
if (end == arg + 2 && end[-1] == ':')
|
||||
--end;
|
||||
|
||||
if (include_type && in_vim9script())
|
||||
{
|
||||
// "a: type" is declaring variable "a" with a type, not "a:".
|
||||
if (end == arg + 2 && end[-1] == ':')
|
||||
--end;
|
||||
if (*end == ':')
|
||||
end = skip_type(skipwhite(end + 1), FALSE);
|
||||
}
|
||||
|
Reference in New Issue
Block a user