Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
20254:c7a2968adc24 | 20255:aac52c32a91f |
---|---|
822 // TODO: whole type, e.g. for a function also arg and return types | 822 // TODO: whole type, e.g. for a function also arg and return types |
823 isn->isn_arg.type.ct_type = vartype->tt_type; | 823 isn->isn_arg.type.ct_type = vartype->tt_type; |
824 isn->isn_arg.type.ct_off = offset; | 824 isn->isn_arg.type.ct_off = offset; |
825 | 825 |
826 // type becomes vartype | 826 // type becomes vartype |
827 ((type_T **)stack->ga_data)[stack->ga_len - 1] = vartype; | 827 ((type_T **)stack->ga_data)[stack->ga_len + offset] = vartype; |
828 | 828 |
829 return OK; | 829 return OK; |
830 } | 830 } |
831 | 831 |
832 /* | 832 /* |
1669 if (p == sp) | 1669 if (p == sp) |
1670 return p; // syntax error | 1670 return p; // syntax error |
1671 if (*p == ',') | 1671 if (*p == ',') |
1672 p = skipwhite(p + 1); | 1672 p = skipwhite(p + 1); |
1673 } | 1673 } |
1674 if (*p == ')' && p[1] == ':') | 1674 if (*p == ')') |
1675 p = skip_type(skipwhite(p + 2)); | 1675 { |
1676 if (p[1] == ':') | |
1677 p = skip_type(skipwhite(p + 2)); | |
1678 else | |
1679 p = skipwhite(p + 1); | |
1680 } | |
1676 } | 1681 } |
1677 | 1682 |
1678 return p; | 1683 return p; |
1679 } | 1684 } |
1680 | 1685 |