1
0
forked from aniani/vim

patch 8.2.4573: a nested function is compiled for debugging without context

Problem:    A nested function (closure) is compiled for debugging without
            context.
Solution:   Check if a nested function is marked for debugging before
            compiling it.  Give an error when trying to compile a closure
            without its context. (closes #9951)
This commit is contained in:
Bram Moolenaar
2022-03-15 15:57:04 +00:00
parent 1a572e9b3b
commit 96923b7a14
6 changed files with 24 additions and 1 deletions

View File

@@ -913,6 +913,7 @@ compile_nested_function(exarg_T *eap, cctx_T *cctx, garray_T *lines_to_free)
}
}
update_has_breakpoint(ufunc);
compile_type = COMPILE_TYPE(ufunc);
#ifdef FEAT_PROFILE
// If the outer function is profiled, also compile the nested function for
@@ -2579,6 +2580,13 @@ compile_def_function(
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);