#endif
EXTERN char e_cannot_use_s_backslash_in_vim9_script[]
INIT(= N_("E1270: Cannot use :s\\/sub/ in Vim9 script"));
+#ifdef FEAT_EVAL
+EXTERN char e_compiling_closure_without_context_str[]
+ INIT(= N_("E1271: compiling closure without context: %s"));
+#endif
/* vim9execute.c */
void to_string_error(vartype_T vartype);
+void update_has_breakpoint(ufunc_T *ufunc);
void funcstack_check_refcount(funcstack_T *funcstack);
int set_ref_in_funcstacks(int copyID);
char_u *char_from_string(char_u *str, varnumber_T index);
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 4573,
/**/
4572,
/**/
}
}
+ update_has_breakpoint(ufunc);
compile_type = COMPILE_TYPE(ufunc);
#ifdef FEAT_PROFILE
// If the outer function is profiled, also compile the nested function for
new_def_function = TRUE;
}
+ if ((ufunc->uf_flags & FC_CLOSURE) && outer_cctx == NULL)
+ {
+ semsg(_(e_compiling_closure_without_context_str),
+ printable_func_name(ufunc));
+ return FAIL;
+ }
+
ufunc->uf_def_status = UF_COMPILING;
CLEAR_FIELD(cctx);
* If debug_tick changed check if "ufunc" has a breakpoint and update
* "uf_has_breakpoint".
*/
- static void
+ void
update_has_breakpoint(ufunc_T *ufunc)
{
if (ufunc->uf_debug_tick != debug_tick)
)
compile_def_function(ufunc, FALSE, CT_NONE, cctx);
+ // if the outer function is not compiled for debugging, this one might be
+ if (cctx->ctx_compile_type != CT_DEBUG)
+ {
+ update_has_breakpoint(ufunc);
+ if (COMPILE_TYPE(ufunc) == CT_DEBUG)
+ compile_def_function(ufunc, FALSE, CT_DEBUG, 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
// dangling pointer.