forked from aniani/vim
patch 9.0.0481: in :def function all closures in loop get the same variables
Problem: In a :def function all closures in a loop get the same variables.
Solution: Use a separate list of variables for LOADOUTER and STOREOUTER.
Not copied at end of loop yet.
This commit is contained in:
@@ -16,7 +16,7 @@ int func_is_global(ufunc_T *ufunc);
|
||||
int func_requires_g_prefix(ufunc_T *ufunc);
|
||||
int func_name_refcount(char_u *name);
|
||||
void func_clear_free(ufunc_T *fp, int force);
|
||||
int copy_func(char_u *lambda, char_u *global, ectx_T *ectx);
|
||||
int copy_lambda_to_global_func(char_u *lambda, char_u *global, short loop_var_idx, short loop_var_count, ectx_T *ectx);
|
||||
int funcdepth_increment(void);
|
||||
void funcdepth_decrement(void);
|
||||
int funcdepth_get(void);
|
||||
|
||||
@@ -11,6 +11,8 @@ char_u *compile_for(char_u *arg_start, cctx_T *cctx);
|
||||
char_u *compile_endfor(char_u *arg, cctx_T *cctx);
|
||||
char_u *compile_while(char_u *arg, cctx_T *cctx);
|
||||
char_u *compile_endwhile(char_u *arg, cctx_T *cctx);
|
||||
short get_loop_var_info(cctx_T *cctx, short *loop_var_idx);
|
||||
int get_loop_var_idx(cctx_T *cctx);
|
||||
char_u *compile_continue(char_u *arg, cctx_T *cctx);
|
||||
char_u *compile_break(char_u *arg, cctx_T *cctx);
|
||||
char_u *compile_block(char_u *arg, cctx_T *cctx);
|
||||
|
||||
@@ -9,7 +9,7 @@ void restore_current_ectx(ectx_T *ectx);
|
||||
int add_defer_function(char_u *name, int argcount, typval_T *argvars);
|
||||
char_u *char_from_string(char_u *str, varnumber_T index);
|
||||
char_u *string_slice(char_u *str, varnumber_T first, varnumber_T last, int exclusive);
|
||||
int fill_partial_and_closure(partial_T *pt, ufunc_T *ufunc, ectx_T *ectx);
|
||||
int fill_partial_and_closure(partial_T *pt, ufunc_T *ufunc, short loop_var_idx, short loop_var_count, ectx_T *ectx);
|
||||
int may_load_script(int sid, int *loaded);
|
||||
typval_T *lookup_debug_var(char_u *name);
|
||||
int may_break_in_function(ufunc_T *ufunc);
|
||||
|
||||
@@ -31,7 +31,7 @@ int generate_CHECKLEN(cctx_T *cctx, int min_len, int more_OK);
|
||||
int generate_STORE(cctx_T *cctx, isntype_T isn_type, int idx, char_u *name);
|
||||
int generate_STORENR(cctx_T *cctx, int idx, varnumber_T value);
|
||||
int generate_LOAD(cctx_T *cctx, isntype_T isn_type, int idx, char_u *name, type_T *type);
|
||||
int generate_LOADOUTER(cctx_T *cctx, int idx, int nesting, type_T *type);
|
||||
int generate_LOADOUTER(cctx_T *cctx, int idx, int nesting, int loop_idx, type_T *type);
|
||||
int generate_LOADV(cctx_T *cctx, char_u *name);
|
||||
int generate_UNLET(cctx_T *cctx, isntype_T isn_type, char_u *name, int forceit);
|
||||
int generate_LOCKCONST(cctx_T *cctx);
|
||||
@@ -40,7 +40,7 @@ int generate_VIM9SCRIPT(cctx_T *cctx, isntype_T isn_type, int sid, int idx, type
|
||||
int generate_NEWLIST(cctx_T *cctx, int count, int use_null);
|
||||
int generate_NEWDICT(cctx_T *cctx, int count, int use_null);
|
||||
int generate_FUNCREF(cctx_T *cctx, ufunc_T *ufunc, isn_T **isnp);
|
||||
int generate_NEWFUNC(cctx_T *cctx, char_u *lambda_name, char_u *func_name);
|
||||
int generate_NEWFUNC(cctx_T *cctx, char_u *lambda_name, char_u *func_name, short loop_var_idx, short loop_var_count);
|
||||
int generate_DEF(cctx_T *cctx, char_u *name, size_t len);
|
||||
int generate_JUMP(cctx_T *cctx, jumpwhen_T when, int where);
|
||||
int generate_WHILE(cctx_T *cctx, int funcref_idx);
|
||||
|
||||
Reference in New Issue
Block a user