Patch 8.2.4872
Problem:    Vim9: no error for using an expression only at the script level
            when followed by an empty line.
Solution:   Do not check the line number but whether something follows.
            (closes #10357)
Files:      src/ex_eval.c, src/testdir/test_vim9_cmd.vim


*** ../vim-8.2.4871/src/ex_eval.c       2022-04-03 16:13:03.416370571 +0100
--- src/ex_eval.c       2022-05-05 16:06:29.648171475 +0100
***************
*** 940,947 ****
      if (eval0(eap->arg, &tv, eap, &evalarg) == OK)
      {
        clear_tv(&tv);
!       if (in_vim9script() && name_only && lnum == SOURCING_LNUM)
            semsg(_(e_expression_without_effect_str), eap->arg);
      }
  
      clear_evalarg(&evalarg, eap);
--- 940,953 ----
      if (eval0(eap->arg, &tv, eap, &evalarg) == OK)
      {
        clear_tv(&tv);
!       if (in_vim9script() && name_only
!               && (evalarg.eval_tofree == NULL
!                   || ends_excmd2(evalarg.eval_tofree,
!                                             skipwhite(evalarg.eval_tofree))))
!       {
!           SOURCING_LNUM = lnum;
            semsg(_(e_expression_without_effect_str), eap->arg);
+       }
      }
  
      clear_evalarg(&evalarg, eap);
*** ../vim-8.2.4871/src/testdir/test_vim9_cmd.vim       2022-04-27 
22:15:35.992839061 +0100
--- src/testdir/test_vim9_cmd.vim       2022-05-05 16:05:00.028253802 +0100
***************
*** 651,656 ****
--- 651,670 ----
    v9.CheckDefAndScriptFailure(lines, 'E1207:', 2)
  
    lines =<< trim END
+       @a = 'echo "text"'
+       @a
+ 
+   END
+   v9.CheckDefAndScriptFailure(lines, 'E1207:', 2)
+ 
+   lines =<< trim END
+       @a = 'echo "text"'
+       @a
+           # comment
+   END
+   v9.CheckDefAndScriptFailure(lines, 'E1207:', 2)
+ 
+   lines =<< trim END
        @/ = 'pattern'
        @/
    END
*** ../vim-8.2.4871/src/version.c       2022-05-05 15:19:59.619770178 +0100
--- src/version.c       2022-05-05 16:05:16.452238835 +0100
***************
*** 748,749 ****
--- 748,751 ----
  {   /* Add new patch number below this line */
+ /**/
+     4872,
  /**/

-- 
Contrary to popular belief, Unix is user friendly.
It just happens to be selective about who it makes friends with.
                                               -- Dave Parnas

 /// 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/20220505150927.756151C0645%40moolenaar.net.

Raspunde prin e-mail lui