Patch 9.0.1446
Problem:    Unnecessary checks for the "skip" flag when skipping.
Solution:   Remove the unnecessary checks. (closes #12254)
Files:      src/userfunc.c


*** ../vim-9.0.1445/src/userfunc.c      2023-03-07 17:45:07.192247897 +0000
--- src/userfunc.c      2023-04-12 20:45:40.423830416 +0100
***************
*** 5868,5873 ****
--- 5868,5876 ----
      clear_evalarg(&evalarg, eap);
  }
  
+ /*
+  * Lower level implementation of "call".  Only called when not skipping.
+  */
      static int
  ex_call_inner(
        exarg_T     *eap,
***************
*** 5882,5905 ****
      typval_T  rettv;
      int               failed = FALSE;
  
!     /*
!      * When skipping, evaluate the function once, to find the end of the
!      * arguments.
!      * When the function takes a range, this is discovered after the first
!      * call, and the loop is broken.
!      */
!     if (eap->skip)
!     {
!       ++emsg_skip;
!       lnum = eap->line2;      // do it once, also with an invalid range
!     }
!     else
!       lnum = eap->line1;
      for ( ; lnum <= eap->line2; ++lnum)
      {
        funcexe_T funcexe;
  
!       if (!eap->skip && eap->addr_count > 0)
        {
            if (lnum > curbuf->b_ml.ml_line_count)
            {
--- 5885,5896 ----
      typval_T  rettv;
      int               failed = FALSE;
  
!     lnum = eap->line1;
      for ( ; lnum <= eap->line2; ++lnum)
      {
        funcexe_T funcexe;
  
!       if (eap->addr_count > 0)
        {
            if (lnum > curbuf->b_ml.ml_line_count)
            {
***************
*** 5927,5940 ****
  
        // Handle a function returning a Funcref, Dictionary or List.
        if (handle_subscript(arg, NULL, &rettv,
!                          eap->skip ? NULL : &EVALARG_EVALUATE, TRUE) == FAIL)
        {
            failed = TRUE;
            break;
        }
  
        clear_tv(&rettv);
!       if (doesrange || eap->skip)
            break;
  
        // Stop when immediately aborting on error, or when an interrupt
--- 5918,5931 ----
  
        // Handle a function returning a Funcref, Dictionary or List.
        if (handle_subscript(arg, NULL, &rettv,
!                                             &EVALARG_EVALUATE, TRUE) == FAIL)
        {
            failed = TRUE;
            break;
        }
  
        clear_tv(&rettv);
!       if (doesrange)
            break;
  
        // Stop when immediately aborting on error, or when an interrupt
***************
*** 5944,5951 ****
        if (aborting())
            break;
      }
-     if (eap->skip)
-       --emsg_skip;
      return failed;
  }
  
--- 5935,5940 ----
***************
*** 6185,6191 ****
        return;
      }
  
!     tofree = trans_function_name_ext(&arg, NULL, eap->skip, TFN_INT,
                             &fudi, &partial, vim9script ? &type : NULL, NULL);
      if (fudi.fd_newkey != NULL)
      {
--- 6174,6180 ----
        return;
      }
  
!     tofree = trans_function_name_ext(&arg, NULL, FALSE, TFN_INT,
                             &fudi, &partial, vim9script ? &type : NULL, NULL);
      if (fudi.fd_newkey != NULL)
      {
***************
*** 6239,6245 ****
        funcexe.fe_firstline = eap->line1;
        funcexe.fe_lastline = eap->line2;
        funcexe.fe_found_var = found_var;
!       funcexe.fe_evaluate = !eap->skip;
        failed = ex_call_inner(eap, name, &arg, startarg, &funcexe, &evalarg);
      }
  
--- 6228,6234 ----
        funcexe.fe_firstline = eap->line1;
        funcexe.fe_lastline = eap->line2;
        funcexe.fe_found_var = found_var;
!       funcexe.fe_evaluate = TRUE;
        failed = ex_call_inner(eap, name, &arg, startarg, &funcexe, &evalarg);
      }
  
*** ../vim-9.0.1445/src/version.c       2023-04-12 16:23:59.460592878 +0100
--- src/version.c       2023-04-12 20:44:37.943880498 +0100
***************
*** 697,698 ****
--- 697,700 ----
  {   /* Add new patch number below this line */
+ /**/
+     1446,
  /**/

-- 
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 -- [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/20230412194848.18C501C0F2A%40moolenaar.net.

Raspunde prin e-mail lui