comparison src/scriptfile.c @ 20538:9f921ba86d05 v8.2.0823

patch 8.2.0823: Vim9: script reload test is disabled Commit: https://github.com/vim/vim/commit/25e0f5863e9010a75a1ff0d04e8f886403968755 Author: Bram Moolenaar <Bram@vim.org> Date: Mon May 25 22:36:50 2020 +0200 patch 8.2.0823: Vim9: script reload test is disabled Problem: Vim9: script reload test is disabled. Solution: Compile a function in the context of the script where it was defined. Set execution stack for compiled function. Add a test that an error is reported for the right file/function.
author Bram Moolenaar <Bram@vim.org>
date Mon, 25 May 2020 22:45:03 +0200
parents 8fa783f2c69c
children 187c3fb42c8f
comparison
equal deleted inserted replaced
20537:cceaa5ec43aa 20538:9f921ba86d05
67 #if defined(FEAT_EVAL) || defined(PROTO) 67 #if defined(FEAT_EVAL) || defined(PROTO)
68 /* 68 /*
69 * Add a user function to the execution stack. 69 * Add a user function to the execution stack.
70 */ 70 */
71 void 71 void
72 estack_push_ufunc(etype_T type, ufunc_T *ufunc, long lnum) 72 estack_push_ufunc(ufunc_T *ufunc, long lnum)
73 { 73 {
74 estack_T *entry = estack_push(type, 74 estack_T *entry = estack_push(ETYPE_UFUNC,
75 ufunc->uf_name_exp != NULL 75 ufunc->uf_name_exp != NULL
76 ? ufunc->uf_name_exp : ufunc->uf_name, lnum); 76 ? ufunc->uf_name_exp : ufunc->uf_name, lnum);
77 if (entry != NULL) 77 if (entry != NULL)
78 entry->es_info.ufunc = ufunc; 78 entry->es_info.ufunc = ufunc;
79 }
80
81 /*
82 * Return TRUE if "ufunc" with "lnum" is already at the top of the exe stack.
83 */
84 int
85 estack_top_is_ufunc(ufunc_T *ufunc, long lnum)
86 {
87 estack_T *entry;
88
89 if (exestack.ga_len == 0)
90 return FALSE;
91 entry = ((estack_T *)exestack.ga_data) + exestack.ga_len - 1;
92 return entry->es_type == ETYPE_UFUNC
93 && STRCMP( entry->es_name, ufunc->uf_name_exp != NULL
94 ? ufunc->uf_name_exp : ufunc->uf_name) == 0
95 && entry->es_lnum == lnum;
79 } 96 }
80 #endif 97 #endif
81 98
82 /* 99 /*
83 * Take an item off of the execution stack. 100 * Take an item off of the execution stack.