patch 8.2.2223: Vim9: Reloading marks a :def function as deleted
Problem: Vim9: Reloading marks a :def function as deleted.
Solution: Clear the function contents but keep the index.
diff --git a/src/userfunc.c b/src/userfunc.c
index cc41eed..e496bce 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -3628,7 +3628,7 @@
fp->uf_profiling = FALSE;
fp->uf_prof_initialized = FALSE;
#endif
- unlink_def_function(fp);
+ fp->uf_def_status = UF_NOT_COMPILED;
}
}
}
@@ -3694,8 +3694,6 @@
fp = alloc_clear(offsetof(ufunc_T, uf_name) + STRLEN(name) + 1);
if (fp == NULL)
goto erret;
- fp->uf_def_status = eap->cmdidx == CMD_def ? UF_TO_BE_COMPILED
- : UF_NOT_COMPILED;
if (fudi.fd_dict != NULL)
{