Mercurial > vim
diff src/vim9compile.c @ 20255:aac52c32a91f v8.2.0683
patch 8.2.0683: Vim9: parsing type does not always work
Commit: https://github.com/vim/vim/commit/5adc55cb746893c6ddf7865ff654582902dee2e3
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 2 23:12:58 2020 +0200
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 02 May 2020 23:15:03 +0200 |
parents | 6f9010b6f7f9 |
children | b69e30dc6e6a |
line wrap: on
line diff
--- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -824,7 +824,7 @@ generate_TYPECHECK(cctx_T *cctx, type_T 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;