Patch 9.0.0056
Problem:    Wrong line number reported when :cexpr fails in :def function.
Solution:   Set line_number before executing :cexpr. (closes #10735)
Files:      src/vim9execute.c, src/testdir/test_vim9_func.vim


*** ../vim-9.0.0056/src/vim9execute.c   2022-06-29 13:18:23.890571774 +0100
--- src/vim9execute.c   2022-07-18 17:43:41.597215628 +0100
***************
*** 2786,2791 ****
--- 2786,2792 ----
                    ea.cmdlinep = &iptr->isn_arg.cexpr.cexpr_ref->cer_cmdline;
                    --ectx->ec_stack.ga_len;
                    tv = STACK_TV_BOT(0);
+                   SOURCING_LNUM = iptr->isn_lnum;
                    res = cexpr_core(&ea, tv);
                    clear_tv(tv);
                    if (res == FAIL)
*** ../vim-9.0.0056/src/testdir//test_vim9_func.vim     2022-05-26 
21:27:44.000000000 +0100
--- src/testdir//test_vim9_func.vim     2022-07-18 17:37:18.690053967 +0100
***************
*** 4205,4210 ****
--- 4205,4222 ----
    v9.CheckScriptSuccess(lines)
  enddef
  
+ def Test_cexpr_errmsg_line_number()
+   var lines =<< trim END
+       vim9script
+       def Func()
+         var qfl = {}
+         cexpr qfl
+       enddef
+       Func()
+   END
+   v9.CheckScriptFailure(lines, 'E777', 2)
+ enddef
+ 
  " The following messes up syntax highlight, keep near the end.
  if has('python3')
    def Test_python3_command()
*** ../vim-9.0.0056/src/version.c       2022-07-16 17:46:41.673744844 +0100
--- src/version.c       2022-07-18 17:39:21.953785258 +0100
***************
*** 737,738 ****
--- 737,740 ----
  {   /* Add new patch number below this line */
+ /**/
+     56,
  /**/

-- 
I AM THANKFUL...
...for the clothes that fit a little too snug because it
means I have more than enough to eat.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            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/20220718165130.035651C091B%40moolenaar.net.

Raspunde prin e-mail lui