patch 8.2.0818: Vim9: using a discovery phase doesn't work well
Problem: Vim9: using a discovery phase doesn't work well.
Solution: Remove the discovery phase, instead compile a function only when
it is used. Add :defcompile to compile def functions earlier.
diff --git a/src/proto/evalvars.pro b/src/proto/evalvars.pro
index 3d07a6d..58e9221 100644
--- a/src/proto/evalvars.pro
+++ b/src/proto/evalvars.pro
@@ -16,7 +16,6 @@
list_T *heredoc_get(exarg_T *eap, char_u *cmd, int script_get);
void ex_let(exarg_T *eap);
void ex_const(exarg_T *eap);
-void ex_let_const(exarg_T *eap, int redefine);
int ex_let_vars(char_u *arg_start, typval_T *tv, int copy, int semicolon, int var_count, int flags, char_u *op);
char_u *skip_var_list(char_u *arg, int include_type, int *var_count, int *semicolon);
void list_hashtable_vars(hashtab_T *ht, char *prefix, int empty, int *first);
diff --git a/src/proto/userfunc.pro b/src/proto/userfunc.pro
index 4295ce2..6ed79ba 100644
--- a/src/proto/userfunc.pro
+++ b/src/proto/userfunc.pro
@@ -23,8 +23,9 @@
int call_func(char_u *funcname, int len, typval_T *rettv, int argcount_in, typval_T *argvars_in, funcexe_T *funcexe);
char_u *trans_function_name(char_u **pp, int *is_global, int skip, int flags, funcdict_T *fdp, partial_T **partial);
char_u *untrans_function_name(char_u *name);
-ufunc_T *def_function(exarg_T *eap, char_u *name_arg, void *context, int compile);
+ufunc_T *def_function(exarg_T *eap, char_u *name_arg);
void ex_function(exarg_T *eap);
+void ex_defcompile(exarg_T *eap);
int eval_fname_script(char_u *p);
int translated_function_exists(char_u *name, int is_global);
int has_varargs(ufunc_T *ufunc);
diff --git a/src/proto/vim9compile.pro b/src/proto/vim9compile.pro
index 6a3d9b5..67c7224 100644
--- a/src/proto/vim9compile.pro
+++ b/src/proto/vim9compile.pro
@@ -9,8 +9,7 @@
char_u *to_name_const_end(char_u *arg);
int assignment_len(char_u *p, int *heredoc);
int check_vim9_unlet(char_u *name);
-int add_def_function(ufunc_T *ufunc);
-void compile_def_function(ufunc_T *ufunc, int set_return_type, cctx_T *outer_cctx);
+int compile_def_function(ufunc_T *ufunc, int set_return_type, cctx_T *outer_cctx);
void delete_instr(isn_T *isn);
void delete_def_function(ufunc_T *ufunc);
void free_def_functions(void);