aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_eval.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-08-13 17:52:04 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-08-14 04:29:44 +0800
commit1ca2247639424994890ef70ab34f2bffa23ddd9f (patch)
treec3697b80da96e6e1165742979deb121ca491b1d0 /src/nvim/ex_eval.c
parenta10a23aae91a8356b36ac63f0917a556cfcaf976 (diff)
downloadrneovim-1ca2247639424994890ef70ab34f2bffa23ddd9f.tar.gz
rneovim-1ca2247639424994890ef70ab34f2bffa23ddd9f.tar.bz2
rneovim-1ca2247639424994890ef70ab34f2bffa23ddd9f.zip
vim-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. https://github.com/vim/vim/commit/25e0f5863e9010a75a1ff0d04e8f886403968755 Omit stack_top_is_ufunc(): only used by Vim9 script.
Diffstat (limited to 'src/nvim/ex_eval.c')
-rw-r--r--src/nvim/ex_eval.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c
index 0d10be2a97..66c782d12e 100644
--- a/src/nvim/ex_eval.c
+++ b/src/nvim/ex_eval.c
@@ -275,6 +275,11 @@ bool cause_errthrow(const char *mesg, bool severe, bool *ignore)
(*msg_list)->throw_msg = tmsg;
}
}
+
+ // Get the source name and lnum now, it may change before
+ // reaching do_errthrow().
+ elem->sfile = estack_sfile();
+ elem->slnum = SOURCING_LNUM;
}
return true;
}
@@ -289,6 +294,7 @@ static void free_msglist(msglist_T *l)
while (messages != NULL) {
next = messages->next;
xfree(messages->msg);
+ xfree(messages->sfile);
xfree(messages);
messages = next;
}
@@ -478,11 +484,18 @@ static int throw_exception(void *value, except_type_T type, char *cmdname)
}
excp->type = type;
- excp->throw_name = estack_sfile();
- if (excp->throw_name == NULL) {
- excp->throw_name = xstrdup("");
+ if (type == ET_ERROR && ((msglist_T *)value)->sfile != NULL) {
+ msglist_T *entry = (msglist_T *)value;
+ excp->throw_name = entry->sfile;
+ entry->sfile = NULL;
+ excp->throw_lnum = entry->slnum;
+ } else {
+ excp->throw_name = estack_sfile();
+ if (excp->throw_name == NULL) {
+ excp->throw_name = xstrdup("");
+ }
+ excp->throw_lnum = SOURCING_LNUM;
}
- excp->throw_lnum = SOURCING_LNUM;
if (p_verbose >= 13 || debug_break_level > 0) {
int save_msg_silent = msg_silent;