CheckDefExecAndScriptFailure(lines, 'some error continued', 1)
enddef
+def Test_debug_with_lambda()
+ CheckRunVimInTerminal
+
+ var lines =<< trim END
+ vim9script
+ def Func()
+ var n = 0
+ echo [0]->filter((_, v) => v == n)
+ enddef
+ breakadd func Func
+ Func()
+ END
+ writefile(lines, 'XdebugFunc')
+ var buf = RunVimInTerminal('-S XdebugFunc', {rows: 6, wait_for_ruler: 0})
+ WaitForAssert(() => assert_match('^>', term_getline(buf, 6)))
+
+ term_sendkeys(buf, "cont\<CR>")
+ WaitForAssert(() => assert_match('\[0\]', term_getline(buf, 5)))
+
+ StopVimInTerminal(buf)
+ delete('XdebugFunc')
+enddef
+
def ProfiledWithLambda()
var n = 3
echo [[1, 2], [3, 4]]->filter((_, l) => l[0] == n)
ufunc->uf_ret_type = &t_unknown;
compile_def_function(ufunc, FALSE, cctx->ctx_compile_type, cctx);
+ // When the outer function is compiled for profiling or debugging, the
+ // lambda may be called without profiling or debugging. Compile it here in
+ // the right context.
+ if (cctx->ctx_compile_type == CT_DEBUG
#ifdef FEAT_PROFILE
- // When the outer function is compiled for profiling, the lambda may be
- // called without profiling. Compile it here in the right context.
- if (cctx->ctx_compile_type == CT_PROFILE)
- compile_def_function(ufunc, FALSE, CT_NONE, cctx);
+ || cctx->ctx_compile_type == CT_PROFILE
#endif
+ )
+ compile_def_function(ufunc, FALSE, CT_NONE, cctx);
// The last entry in evalarg.eval_tofree_ga is a copy of the last line and
// "*arg" may point into it. Point into the original line to avoid a