Mercurial > vim
comparison src/vim9compile.c @ 21441:78d97ee2c707 v8.2.1271
patch 8.2.1271: Vim9: Error for Funcref function argument type
Commit: https://github.com/vim/vim/commit/0f60e80f9b6d778e460b4dc8333cd8e17c1b620b
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jul 22 20:16:11 2020 +0200
patch 8.2.1271: Vim9: Error for Funcref function argument type
Problem: Vim9: Error for Funcref function argument type.
Solution: Find the actual function type if possible. (issue https://github.com/vim/vim/issues/6507)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 22 Jul 2020 20:30:04 +0200 |
parents | 166c15374bda |
children | 66386ca8a69f |
comparison
equal
deleted
inserted
replaced
21440:bd0a3a73f3da | 21441:78d97ee2c707 |
---|---|
596 dict_iterate_next(&iter, &value); | 596 dict_iterate_next(&iter, &value); |
597 CLEAR_FIELD(member); | 597 CLEAR_FIELD(member); |
598 member.tt_type = value->v_type; | 598 member.tt_type = value->v_type; |
599 member.tt_member = &t_any; | 599 member.tt_member = &t_any; |
600 actual.tt_member = &member; | 600 actual.tt_member = &member; |
601 } | |
602 else if (actual_tv->v_type == VAR_FUNC || actual_tv->v_type == VAR_PARTIAL) | |
603 { | |
604 char_u *name = NULL; | |
605 ufunc_T *ufunc = NULL; | |
606 | |
607 if (actual_tv->v_type == VAR_PARTIAL) | |
608 { | |
609 if (actual_tv->vval.v_partial->pt_func != NULL) | |
610 ufunc = actual_tv->vval.v_partial->pt_func; | |
611 else | |
612 name = actual_tv->vval.v_partial->pt_name; | |
613 } | |
614 else | |
615 name = actual_tv->vval.v_string; | |
616 if (name != NULL) | |
617 // TODO: how about a builtin function? | |
618 ufunc = find_func(name, FALSE, NULL); | |
619 if (ufunc != NULL && ufunc->uf_func_type != NULL) | |
620 actual = *ufunc->uf_func_type; | |
621 else | |
622 actual.tt_member = &t_any; | |
601 } | 623 } |
602 else | 624 else |
603 actual.tt_member = &t_any; | 625 actual.tt_member = &t_any; |
604 return check_type(expected, &actual, TRUE); | 626 return check_type(expected, &actual, TRUE); |
605 } | 627 } |