Mercurial > vim
diff src/vim9compile.c @ 24539:3a290891a015 v8.2.2809
patch 8.2.2809: Vim9: :def function compilation fails when using :legacy
Commit: https://github.com/vim/vim/commit/dc4c2309f2af347068edd60548269018f476dab9
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Apr 25 13:54:42 2021 +0200
patch 8.2.2809: Vim9: :def function compilation fails when using :legacy
Problem: Vim9: :def function compilation fails when using :legacy.
Solution: Reset CMOD_LEGACY when compiling a function. (closes https://github.com/vim/vim/issues/8137)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 25 Apr 2021 14:00:03 +0200 |
parents | 9c404d78d767 |
children | 2818f846f099 |
line wrap: on
line diff
--- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -8767,6 +8767,7 @@ compile_def_function( int ret = FAIL; sctx_T save_current_sctx = current_sctx; int save_estack_compiling = estack_compiling; + int save_cmod_flags = cmdmod.cmod_flags; int do_estack_push; int new_def_function = FALSE; #ifdef FEAT_PROFILE @@ -8811,6 +8812,9 @@ compile_def_function( current_sctx = ufunc->uf_script_ctx; current_sctx.sc_version = SCRIPT_VERSION_VIM9; + // Don't use the flag from ":legacy" here. + cmdmod.cmod_flags &= ~CMOD_LEGACY; + // Make sure error messages are OK. do_estack_push = !estack_top_is_ufunc(ufunc, 1); if (do_estack_push) @@ -9403,6 +9407,7 @@ erret: current_sctx = save_current_sctx; estack_compiling = save_estack_compiling; + cmdmod.cmod_flags = save_cmod_flags; if (do_estack_push) estack_pop();