Patch 8.2.2265
Problem:    Error message for missing endfunc/enddef is last line.
Solution:   Report the line where the function starts. (closes #7582)
Files:      src/userfunc.c, src/testdir/test_vim9_func.vim


*** ../vim-8.2.2264/src/userfunc.c      2021-01-01 18:43:46.260466448 +0100
--- src/userfunc.c      2021-01-01 18:46:26.764140209 +0100
***************
*** 3352,3357 ****
--- 3352,3359 ----
            lines_left = Rows - 1;
        if (theline == NULL)
        {
+           // Use the start of the function for the line number.
+           SOURCING_LNUM = sourcing_lnum_top;
            if (skip_until != NULL)
                semsg(_(e_missing_heredoc_end_marker_str), skip_until);
            else if (eap->cmdidx == CMD_def)
*** ../vim-8.2.2264/src/testdir/test_vim9_func.vim      2021-01-01 
18:43:46.264466441 +0100
--- src/testdir/test_vim9_func.vim      2021-01-01 18:50:50.595506776 +0100
***************
*** 98,103 ****
--- 98,121 ----
    CheckScriptFailure(lines, 'E1152:', 4)
  enddef
  
+ def Test_missing_endfunc_enddef()
+   var lines =<< trim END
+     vim9script
+     def Test()
+       echo 'test'
+     endef
+   END
+   CheckScriptFailure(lines, 'E1057:', 2)
+ 
+   lines =<< trim END
+     vim9script
+     func Some()
+       echo 'test'
+     enfffunc
+   END
+   CheckScriptFailure(lines, 'E126:', 2)
+ enddef
+ 
  def ReturnString(): string
    return 'string'
  enddef
*** ../vim-8.2.2264/src/version.c       2021-01-01 18:43:46.264466441 +0100
--- src/version.c       2021-01-01 18:47:38.251978660 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2265,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
79. All of your most erotic dreams have a scrollbar at the right side.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202101011755.101HtOtS1594519%40masaka.moolenaar.net.

Raspunde prin e-mail lui