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>
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
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)
current_sctx = save_current_sctx;
estack_compiling = save_estack_compiling;
+ cmdmod.cmod_flags = save_cmod_flags;
if (do_estack_push)
estack_pop();