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

patch 8.2.0683: Vim9: parsing type does not always work

Problem:    Vim9: parsing type does not always work.
Solution:   Handle func type without return value.  Test more closures.
            Fix type check offset.  Fix garbage collection.
This commit is contained in:
Bram Moolenaar
2020-05-02 23:12:58 +02:00
parent 1c0d44f8ef
commit 5adc55cb74
6 changed files with 84 additions and 6 deletions

View File

@@ -824,7 +824,7 @@ generate_TYPECHECK(cctx_T *cctx, type_T *vartype, int offset)
isn->isn_arg.type.ct_off = offset;
// type becomes vartype
((type_T **)stack->ga_data)[stack->ga_len - 1] = vartype;
((type_T **)stack->ga_data)[stack->ga_len + offset] = vartype;
return OK;
}
@@ -1671,8 +1671,13 @@ skip_type(char_u *start)
if (*p == ',')
p = skipwhite(p + 1);
}
if (*p == ')' && p[1] == ':')
p = skip_type(skipwhite(p + 2));
if (*p == ')')
{
if (p[1] == ':')
p = skip_type(skipwhite(p + 2));
else
p = skipwhite(p + 1);
}
}
return p;