To: vim_dev@googlegroups.com Subject: Patch 8.2.3633 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3633 Problem: Vim9: line number of lambda is off by one. Solution: Add one to the line number. (closes #9083) Files: src/userfunc.c, src/testdir/test_vim9_func.vim *** ../vim-8.2.3632/src/userfunc.c 2021-10-23 13:32:27.223954845 +0100 --- src/userfunc.c 2021-11-20 21:25:45.013587301 +0000 *************** *** 1491,1497 **** 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; function_using_block_scopes(fp, evalarg->eval_cstack); --- 1491,1497 ---- 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 + 1; function_using_block_scopes(fp, evalarg->eval_cstack); *** ../vim-8.2.3632/src/testdir/test_vim9_func.vim 2021-10-23 13:32:27.227954893 +0100 --- src/testdir/test_vim9_func.vim 2021-11-20 21:24:09.637660078 +0000 *************** *** 1052,1057 **** --- 1052,1071 ---- CheckScriptFailure(['vim9script'] + lines, 'E118: Too many arguments for function: ', 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 *** ../vim-8.2.3632/src/version.c 2021-11-20 20:42:25.700580223 +0000 --- src/version.c 2021-11-20 21:25:08.501615287 +0000 *************** *** 759,760 **** --- 759,762 ---- { /* Add new patch number below this line */ + /**/ + 3633, /**/ -- ARTHUR: Go on, Bors, chop its head off. BORS: Right. Silly little bleeder. One rabbit stew coming up. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///