To: vim_dev@googlegroups.com Subject: Patch 8.2.3352 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3352 Problem: Vim9: error for nested :enddef has wrong line number. Solution: Compute the line number. Files: src/userfunc.c, src/testdir/test_vim9_func.vim *** ../vim-8.2.3351/src/userfunc.c 2021-08-08 19:07:32.924667679 +0200 --- src/userfunc.c 2021-08-15 19:23:05.021181524 +0200 *************** *** 822,827 **** --- 822,829 ---- else if (*p != NUL && *p != (vim9_function ? '#' : '"') && (vim9_function || p_verbose > 0)) { + SOURCING_LNUM = sourcing_lnum_top + + newlines->ga_len + 1; if (eap->cmdidx == CMD_def) semsg(_(e_text_found_after_enddef_str), p); else *** ../vim-8.2.3351/src/testdir/test_vim9_func.vim 2021-08-15 16:08:32.374709637 +0200 --- src/testdir/test_vim9_func.vim 2021-08-15 19:26:44.720722616 +0200 *************** *** 630,635 **** --- 630,646 ---- assert_equal(2, Test()) END CheckScriptSuccess(lines) + + lines =<< trim END + vim9script + def Outer() + def Inner() + echo 'hello' + enddef burp + enddef + defcompile + END + CheckScriptFailure(lines, 'E1173: Text found after enddef: burp', 3) enddef def Test_not_nested_function() *** ../vim-8.2.3351/src/version.c 2021-08-15 16:08:32.374709637 +0200 --- src/version.c 2021-08-15 19:24:38.652987509 +0200 *************** *** 757,758 **** --- 757,760 ---- { /* Add new patch number below this line */ + /**/ + 3352, /**/ -- User: I'm having problems with my text editor. Help desk: Which editor are you using? User: I don't know, but it's version VI (pronounced: 6). Help desk: Oh, then you should upgrade to version VIM (pronounced: 994). /// 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 ///