Mercurial > vim
comparison src/vim9compile.c @ 25300:e56c8dc1a534 v8.2.3187
patch 8.2.3187: Vim9: popup timer callback is not compiled
Commit: https://github.com/vim/vim/commit/9bb0dad0d8283c86fddf5b950f4fbb6fb8f12741
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jul 19 22:19:29 2021 +0200
patch 8.2.3187: Vim9: popup timer callback is not compiled
Problem: Vim9: popup timer callback is not compiled.
Solution: Compile the callback when creating the timer.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 19 Jul 2021 22:30:04 +0200 |
parents | 9bce044c7643 |
children | a386f83499ed |
comparison
equal
deleted
inserted
replaced
25299:a1eb85c2e0a5 | 25300:e56c8dc1a534 |
---|---|
3665 // function is freed. | 3665 // function is freed. |
3666 return generate_FUNCREF(cctx, ufunc); | 3666 return generate_FUNCREF(cctx, ufunc); |
3667 } | 3667 } |
3668 | 3668 |
3669 func_ptr_unref(ufunc); | 3669 func_ptr_unref(ufunc); |
3670 return FAIL; | |
3671 } | |
3672 | |
3673 /* | |
3674 * Get a lambda and compile it. Uses Vim9 syntax. | |
3675 */ | |
3676 int | |
3677 get_lambda_tv_and_compile( | |
3678 char_u **arg, | |
3679 typval_T *rettv, | |
3680 int types_optional, | |
3681 evalarg_T *evalarg) | |
3682 { | |
3683 int r; | |
3684 ufunc_T *ufunc; | |
3685 int save_sc_version = current_sctx.sc_version; | |
3686 | |
3687 // Get the funcref in "rettv". | |
3688 current_sctx.sc_version = SCRIPT_VERSION_VIM9; | |
3689 r = get_lambda_tv(arg, rettv, types_optional, evalarg); | |
3690 current_sctx.sc_version = save_sc_version; | |
3691 if (r != OK) | |
3692 return r; | |
3693 | |
3694 // "rettv" will now be a partial referencing the function. | |
3695 ufunc = rettv->vval.v_partial->pt_func; | |
3696 | |
3697 // Compile it here to get the return type. The return type is optional, | |
3698 // when it's missing use t_unknown. This is recognized in | |
3699 // compile_return(). | |
3700 if (ufunc->uf_ret_type == NULL || ufunc->uf_ret_type->tt_type == VAR_VOID) | |
3701 ufunc->uf_ret_type = &t_unknown; | |
3702 compile_def_function(ufunc, FALSE, CT_NONE, NULL); | |
3703 | |
3704 if (ufunc->uf_def_status == UF_COMPILED) | |
3705 { | |
3706 // The return type will now be known. | |
3707 set_function_type(ufunc); | |
3708 return OK; | |
3709 } | |
3710 clear_tv(rettv); | |
3670 return FAIL; | 3711 return FAIL; |
3671 } | 3712 } |
3672 | 3713 |
3673 /* | 3714 /* |
3674 * parse a dict: {key: val, [key]: val} | 3715 * parse a dict: {key: val, [key]: val} |