diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-11-20 21:35:41 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-11-20 21:35:41 +0000 |
commit | a755fdbe80bed4897e06028f0044c208e0f9d8cb (patch) | |
tree | 38d4d414a34ce8fc7de1545df9478d215878517e /src | |
parent | 9cd9385db7d1d2b2dc38a511d121e366a5dae511 (diff) |
patch 8.2.3633: Vim9: line number of lambda is off by onev8.2.3633
Problem: Vim9: line number of lambda is off by one.
Solution: Add one to the line number. (closes #9083)
Diffstat (limited to 'src')
-rw-r--r-- | src/testdir/test_vim9_func.vim | 14 | ||||
-rw-r--r-- | src/userfunc.c | 2 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 17 insertions, 1 deletions
diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim index 3d1ae26803..c8b821e751 100644 --- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -1052,6 +1052,20 @@ def Test_call_lambda_args() CheckScriptFailure(['vim9script'] + lines, 'E118: Too many arguments for function: <lambda>', 2) enddef +def Test_lambda_line_nr() + var lines =<< trim END + vim9script + # comment + # comment + var id = timer_start(1'000, (_) => 0) + var out = execute('verbose ' .. timer_info(id)[0].callback + ->string() + ->substitute("('\\|')", ' ', 'g')) + assert_match('Last set from .* line 4', out) + END + CheckScriptSuccess(lines) +enddef + def FilterWithCond(x: string, Cond: func(string): bool): bool return Cond(x) enddef diff --git a/src/userfunc.c b/src/userfunc.c index 2f0637e7db..95d9c4a94b 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -1491,7 +1491,7 @@ get_lambda_tv( fp->uf_flags = flags; fp->uf_calls = 0; fp->uf_script_ctx = current_sctx; - fp->uf_script_ctx.sc_lnum += SOURCING_LNUM - newlines.ga_len; + fp->uf_script_ctx.sc_lnum += SOURCING_LNUM - newlines.ga_len + 1; function_using_block_scopes(fp, evalarg->eval_cstack); diff --git a/src/version.c b/src/version.c index 8eca0877d5..b53524ff1d 100644 --- a/src/version.c +++ b/src/version.c @@ -758,6 +758,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 3633, +/**/ 3632, /**/ 3631, |