Mercurial > vim
diff src/vim9execute.c @ 20279:49b50843e725 v8.2.0695
patch 8.2.0695: Vim9: cannot define a function inside a function
Commit: https://github.com/vim/vim/commit/04b12697838b232b8b17c553ccc74cf1f1bdb81c
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon May 4 23:24:44 2020 +0200
patch 8.2.0695: Vim9: cannot define a function inside a function
Problem: Vim9: cannot define a function inside a function.
Solution: Initial support for :def inside :def.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 04 May 2020 23:30:04 +0200 |
parents | 683c2da4982b |
children | ab8c8fd0f868 |
line wrap: on
line diff
--- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -206,6 +206,11 @@ call_dfunc(int cdf_idx, int argcount_arg + dfunc->df_varcount + dfunc->df_closure_count) == FAIL) return FAIL; + // Closure may need the function context where it was defined. + // TODO: assuming current context. + ectx->ec_outer_stack = &ectx->ec_stack; + ectx->ec_outer_frame = ectx->ec_frame_idx; + // Move the vararg-list to below the missing optional arguments. if (vararg_count > 0 && arg_to_add > 0) *STACK_TV_BOT(arg_to_add - 1) = *STACK_TV_BOT(-1);