summaryrefslogtreecommitdiffstats
path: root/src/userfunc.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-04-12 22:02:36 +0200
committerBram Moolenaar <Bram@vim.org>2021-04-12 22:02:36 +0200
commitf48b2fa33cda94e963f6fa8b78f344385c9ebea6 (patch)
treee65e350985a0baf3870a1a9567d02bd6d8e90734 /src/userfunc.c
parent68452177ca4cda4a9d5f93892e437447cf9404c8 (diff)
patch 8.2.2758: Vim9: wrong line number for autoload function with wrong namev8.2.2758
Problem: Vim9: wrong line number for autoload function with wrong name. Solution: Set and restore SOURCING_LNUM. (closes #8100)
Diffstat (limited to 'src/userfunc.c')
-rw-r--r--src/userfunc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/userfunc.c b/src/userfunc.c
index 54335d41f9..772d45d126 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -4058,7 +4058,11 @@ define_function(exarg_T *eap, char_u *name_arg)
}
if (j == FAIL)
{
+ linenr_T save_lnum = SOURCING_LNUM;
+
+ SOURCING_LNUM = sourcing_lnum_top;
semsg(_("E746: Function name does not match script file name: %s"), name);
+ SOURCING_LNUM = save_lnum;
goto erret;
}
}