comparison src/vim9execute.c @ 20255:aac52c32a91f v8.2.0683

patch 8.2.0683: Vim9: parsing type does not always work Commit: https://github.com/vim/vim/commit/5adc55cb746893c6ddf7865ff654582902dee2e3 Author: Bram Moolenaar <Bram@vim.org> Date: Sat May 2 23:12:58 2020 +0200 patch 8.2.0683: Vim9: parsing type does not always work Problem: Vim9: parsing type does not always work. Solution: Handle func type without return value. Test more closures. Fix type check offset. Fix garbage collection.
author Bram Moolenaar <Bram@vim.org>
date Sat, 02 May 2020 23:15:03 +0200
parents e46e72aaff74
children 683c2da4982b
comparison
equal deleted inserted replaced
20254:c7a2968adc24 20255:aac52c32a91f
2435 case ISN_RETURN: 2435 case ISN_RETURN:
2436 smsg("%4d RETURN", current); 2436 smsg("%4d RETURN", current);
2437 break; 2437 break;
2438 case ISN_FUNCREF: 2438 case ISN_FUNCREF:
2439 { 2439 {
2440 funcref_T *funcref = &iptr->isn_arg.funcref;
2440 dfunc_T *df = ((dfunc_T *)def_functions.ga_data) 2441 dfunc_T *df = ((dfunc_T *)def_functions.ga_data)
2441 + iptr->isn_arg.funcref.fr_func; 2442 + funcref->fr_func;
2442 2443
2443 smsg("%4d FUNCREF %s $%d", current, df->df_ufunc->uf_name, 2444 smsg("%4d FUNCREF %s $%d", current, df->df_ufunc->uf_name,
2444 iptr->isn_arg.funcref.fr_var_idx + df->df_varcount); 2445 funcref->fr_var_idx + dfunc->df_varcount);
2445 } 2446 }
2446 break; 2447 break;
2447 2448
2448 case ISN_JUMP: 2449 case ISN_JUMP:
2449 { 2450 {
2673 return FAIL; 2674 return FAIL;
2674 } 2675 }
2675 return OK; 2676 return OK;
2676 } 2677 }
2677 2678
2679 /*
2680 * Mark items in a def function as used.
2681 */
2682 int
2683 set_ref_in_dfunc(ufunc_T *ufunc, int copyID)
2684 {
2685 dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) + ufunc->uf_dfunc_idx;
2686 int abort = FALSE;
2687
2688 if (dfunc->df_funcstack != NULL)
2689 {
2690 typval_T *stack = dfunc->df_funcstack->fs_ga.ga_data;
2691 int idx;
2692
2693 for (idx = 0; idx < dfunc->df_funcstack->fs_ga.ga_len; ++idx)
2694 abort = abort || set_ref_in_item(stack + idx, copyID, NULL, NULL);
2695 }
2696 return abort;
2697 }
2698
2678 2699
2679 #endif // FEAT_EVAL 2700 #endif // FEAT_EVAL