mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.2.1023: Vim9: redefining a function uses a new index every time
Problem: Vim9: redefining a function uses a new index every time. Solution: When redefining a function clear the contents and re-use the index.
This commit is contained in:
@@ -487,10 +487,10 @@ call_ufunc(ufunc_T *ufunc, int argcount, ectx_T *ectx, isn_T *iptr)
|
||||
int error;
|
||||
int idx;
|
||||
|
||||
if (ufunc->uf_dfunc_idx == UF_TO_BE_COMPILED
|
||||
if (ufunc->uf_def_status == UF_TO_BE_COMPILED
|
||||
&& compile_def_function(ufunc, FALSE, NULL) == FAIL)
|
||||
return FAIL;
|
||||
if (ufunc->uf_dfunc_idx >= 0)
|
||||
if (ufunc->uf_def_status == UF_COMPILED)
|
||||
{
|
||||
// The function has been compiled, can call it quickly. For a function
|
||||
// that was defined later: we can call it directly next time.
|
||||
@@ -671,8 +671,8 @@ call_def_function(
|
||||
// Like STACK_TV_VAR but use the outer scope
|
||||
#define STACK_OUT_TV_VAR(idx) (((typval_T *)ectx.ec_outer_stack->ga_data) + ectx.ec_outer_frame + STACK_FRAME_SIZE + idx)
|
||||
|
||||
if (ufunc->uf_dfunc_idx == UF_NOT_COMPILED
|
||||
|| (ufunc->uf_dfunc_idx == UF_TO_BE_COMPILED
|
||||
if (ufunc->uf_def_status == UF_NOT_COMPILED
|
||||
|| (ufunc->uf_def_status == UF_TO_BE_COMPILED
|
||||
&& compile_def_function(ufunc, FALSE, NULL) == FAIL))
|
||||
{
|
||||
if (called_emsg == called_emsg_before)
|
||||
@@ -2379,10 +2379,10 @@ ex_disassemble(exarg_T *eap)
|
||||
semsg(_("E1061: Cannot find function %s"), eap->arg);
|
||||
return;
|
||||
}
|
||||
if (ufunc->uf_dfunc_idx == UF_TO_BE_COMPILED
|
||||
if (ufunc->uf_def_status == UF_TO_BE_COMPILED
|
||||
&& compile_def_function(ufunc, FALSE, NULL) == FAIL)
|
||||
return;
|
||||
if (ufunc->uf_dfunc_idx < 0)
|
||||
if (ufunc->uf_def_status != UF_COMPILED)
|
||||
{
|
||||
semsg(_("E1062: Function %s is not compiled"), eap->arg);
|
||||
return;
|
||||
|
Reference in New Issue
Block a user