summaryrefslogtreecommitdiff
path: root/src/scriptfile.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-05-25 22:36:50 +0200
committerBram Moolenaar <Bram@vim.org>2020-05-25 22:36:50 +0200
commit25e0f5863e9010a75a1ff0d04e8f886403968755 (patch)
treebcb0891919dbc85578b8483487f2ef89ede0f93c /src/scriptfile.c
parent2eec37926db6d31beb36f162ac00357a30c093c8 (diff)
downloadvim-git-25e0f5863e9010a75a1ff0d04e8f886403968755.tar.gz
patch 8.2.0823: Vim9: script reload test is disabledv8.2.0823
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.
Diffstat (limited to 'src/scriptfile.c')
-rw-r--r--src/scriptfile.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/scriptfile.c b/src/scriptfile.c
index f42c3d04b..746a3d344 100644
--- a/src/scriptfile.c
+++ b/src/scriptfile.c
@@ -69,14 +69,31 @@ estack_push(etype_T type, char_u *name, long lnum)
* Add a user function to the execution stack.
*/
void
-estack_push_ufunc(etype_T type, ufunc_T *ufunc, long lnum)
+estack_push_ufunc(ufunc_T *ufunc, long lnum)
{
- estack_T *entry = estack_push(type,
+ estack_T *entry = estack_push(ETYPE_UFUNC,
ufunc->uf_name_exp != NULL
? ufunc->uf_name_exp : ufunc->uf_name, lnum);
if (entry != NULL)
entry->es_info.ufunc = ufunc;
}
+
+/*
+ * Return TRUE if "ufunc" with "lnum" is already at the top of the exe stack.
+ */
+ int
+estack_top_is_ufunc(ufunc_T *ufunc, long lnum)
+{
+ estack_T *entry;
+
+ if (exestack.ga_len == 0)
+ return FALSE;
+ entry = ((estack_T *)exestack.ga_data) + exestack.ga_len - 1;
+ return entry->es_type == ETYPE_UFUNC
+ && STRCMP( entry->es_name, ufunc->uf_name_exp != NULL
+ ? ufunc->uf_name_exp : ufunc->uf_name) == 0
+ && entry->es_lnum == lnum;
+}
#endif
/*