Mercurial > vim
diff src/proto/vim9type.pro @ 26935:ccb9be1cdd71 v8.2.3996
patch 8.2.3996: Vim9: type checking lacks information about declared type
Commit: https://github.com/vim/vim/commit/078a46161e8b1b30bf306d6c1f4f0af7c616a989
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jan 4 15:17:03 2022 +0000
patch 8.2.3996: Vim9: type checking lacks information about declared type
Problem: Vim9: type checking for list and dict lacks information about
declared type.
Solution: Add dv_decl_type and lv_decl_type. Refactor the type stack to
store two types in each entry.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 04 Jan 2022 16:30:06 +0100 |
parents | 57bc1001160b |
children | 374c7d5a096a |
line wrap: on
line diff
--- a/src/proto/vim9type.pro +++ b/src/proto/vim9type.pro @@ -8,7 +8,7 @@ type_T *alloc_func_type(type_T *ret_type type_T *get_func_type(type_T *ret_type, int argcount, garray_T *type_gap); int func_type_add_arg_types(type_T *functype, int argcount, garray_T *type_gap); int need_convert_to_bool(type_T *type, typval_T *tv); -type_T *typval2type(typval_T *tv, int copyID, garray_T *type_gap, int do_member); +type_T *typval2type(typval_T *tv, int copyID, garray_T *type_gap, int flags); type_T *typval2type_vimvar(typval_T *tv, garray_T *type_gap); int check_typval_arg_type(type_T *expected, typval_T *actual_tv, char *func_name, int arg_idx); int check_typval_type(type_T *expected, typval_T *actual_tv, where_T where); @@ -22,7 +22,11 @@ char_u *skip_type(char_u *start, int opt type_T *parse_type(char_u **arg, garray_T *type_gap, int give_error); int equal_type(type_T *type1, type_T *type2, int flags); void common_type(type_T *type1, type_T *type2, type_T **dest, garray_T *type_gap); -type_T *get_member_type_from_stack(type_T **stack_top, int count, int skip, garray_T *type_gap); +int push_type_stack(cctx_T *cctx, type_T *type); +int push_type_stack2(cctx_T *cctx, type_T *type, type_T *decl_type); +void set_type_on_stack(cctx_T *cctx, type_T *type, int offset); +type_T *get_type_on_stack(cctx_T *cctx, int offset); +type_T *get_member_type_from_stack(int count, int skip, type_T **decl_type, cctx_T *cctx); char *vartype_name(vartype_T type); char *type_name(type_T *type, char **tofree); void f_typename(typval_T *argvars, typval_T *rettv);