summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-09-10 22:05:08 +0200
committerBram Moolenaar <Bram@vim.org>2020-09-10 22:05:08 +0200
commitdfa3d5524e816c1ff7f603f9f3b7703a53a0f822 (patch)
tree1e6da35d73a37b3062aca8c408279b0b6391e13e /src
parent895a7a472d2eb4413e63cdad3213cb1ef1633458 (diff)
patch 8.2.1656: Vim9: callstack wrong if :def function calls :def functionv8.2.1656
Problem: Vim9: callstack wrong if :def function calls :def function. Solution: Set the line number before calling. (closes #6914)
Diffstat (limited to 'src')
-rw-r--r--src/testdir/test_vim9_func.vim20
-rw-r--r--src/version.c2
-rw-r--r--src/vim9execute.c1
3 files changed, 23 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim
index ae8f329f97..4e79c89dea 100644
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -1776,5 +1776,25 @@ def Test_restore_modifiers()
assert_equal('', g:ei_after)
enddef
+def StackTop()
+ eval 1
+ eval 2
+ # call not on fourth line
+ StackBot()
+enddef
+
+def StackBot()
+ # throw an error
+ eval [][0]
+enddef
+
+def Test_callstack_def()
+ try
+ StackTop()
+ catch
+ assert_match('Test_callstack_def\[2\]..StackTop\[4\]..StackBot, line 2', v:throwpoint)
+ endtry
+enddef
+
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
diff --git a/src/version.c b/src/version.c
index 2628ed6100..7aa35c2e52 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1656,
+/**/
1655,
/**/
1654,
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 76cafb4c9b..18cfb0213b 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -1665,6 +1665,7 @@ call_def_function(
// call a :def function
case ISN_DCALL:
+ SOURCING_LNUM = iptr->isn_lnum;
if (call_dfunc(iptr->isn_arg.dfunc.cdf_idx,
iptr->isn_arg.dfunc.cdf_argcount,
&ectx) == FAIL)