Patch 8.2.2809

5 views
Skip to first unread message

Bram Moolenaar

unread,
Apr 25, 2021, 7:58:34 AM4/25/21
to vim...@googlegroups.com

Patch 8.2.2809
Problem: Vim9: :def function compilation fails when using :legacy.
Solution: Reset CMOD_LEGACY when compiling a function. (closes #8137)
Files: src/vim9compile.c, src/testdir/test_vim9_func.vim


*** ../vim-8.2.2808/src/vim9compile.c 2021-04-24 19:08:20.488010321 +0200
--- src/vim9compile.c 2021-04-25 13:53:25.384742158 +0200
***************
*** 8767,8772 ****
--- 8767,8773 ----
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,8816 ****
--- 8812,8820 ----
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,9408 ****
--- 9407,9413 ----

current_sctx = save_current_sctx;
estack_compiling = save_estack_compiling;
+ cmdmod.cmod_flags = save_cmod_flags;
if (do_estack_push)
estack_pop();

*** ../vim-8.2.2808/src/testdir/test_vim9_func.vim 2021-04-24 14:15:03.680264471 +0200
--- src/testdir/test_vim9_func.vim 2021-04-25 13:52:57.392694287 +0200
***************
*** 2167,2176 ****
--- 2167,2186 ----

def Test_legacy_lambda()
legacy echo {x -> 'hello ' .. x}('foo')
+
var lines =<< trim END
echo {x -> 'hello ' .. x}('foo')
END
CheckDefAndScriptFailure(lines, 'E720:')
+
+ lines =<< trim END
+ vim9script
+ def Func()
+ echo (() => 'no error')()
+ enddef
+ legacy call s:Func()
+ END
+ CheckScriptSuccess(lines)
enddef

def DoFilterThis(a: string): list<string>
*** ../vim-8.2.2808/src/version.c 2021-04-24 20:43:52.595422087 +0200
--- src/version.c 2021-04-25 13:54:14.116809614 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2809,
/**/

--
Very funny, Scotty. Now beam down my clothes.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages