Mercurial > vim
comparison src/vim9compile.c @ 25214:218df177cff8 v8.2.3143
patch 8.2.3143: Vim9: wrong context if lambda called from profiled function
Commit: https://github.com/vim/vim/commit/d9162550aa47ca3865a5cadf78ff2212a1d8eca7
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jul 11 15:26:13 2021 +0200
patch 8.2.3143: Vim9: wrong context if lambda called from profiled function
Problem: Vim9: A lambda may be compiled with the wrong context if it is
called from a profiled function.
Solution: Compile the lambda with and without profiling. (closes #8543)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 11 Jul 2021 15:30:03 +0200 |
parents | e5d85e83a887 |
children | fbb530e081ca |
comparison
equal
deleted
inserted
replaced
25213:e1995fcc0a37 | 25214:218df177cff8 |
---|---|
3621 // when it's missing use t_unknown. This is recognized in | 3621 // when it's missing use t_unknown. This is recognized in |
3622 // compile_return(). | 3622 // compile_return(). |
3623 if (ufunc->uf_ret_type->tt_type == VAR_VOID) | 3623 if (ufunc->uf_ret_type->tt_type == VAR_VOID) |
3624 ufunc->uf_ret_type = &t_unknown; | 3624 ufunc->uf_ret_type = &t_unknown; |
3625 compile_def_function(ufunc, FALSE, cctx->ctx_compile_type, cctx); | 3625 compile_def_function(ufunc, FALSE, cctx->ctx_compile_type, cctx); |
3626 | |
3627 // When the outer function is compiled for profiling, the lambda may be | |
3628 // called without profiling. Compile it here in the right context. | |
3629 if (cctx->ctx_compile_type == CT_PROFILE) | |
3630 compile_def_function(ufunc, FALSE, CT_NONE, cctx); | |
3626 | 3631 |
3627 // evalarg.eval_tofree_cmdline may have a copy of the last line and "*arg" | 3632 // evalarg.eval_tofree_cmdline may have a copy of the last line and "*arg" |
3628 // points into it. Point to the original line to avoid a dangling pointer. | 3633 // points into it. Point to the original line to avoid a dangling pointer. |
3629 if (evalarg.eval_tofree_cmdline != NULL) | 3634 if (evalarg.eval_tofree_cmdline != NULL) |
3630 { | 3635 { |