Patch 9.0.1446

2 views
Skip to first unread message

Bram Moolenaar

unread,
Apr 12, 2023, 3:48:52 PM4/12/23
to vim...@googlegroups.com

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 -- Br...@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 ///
Reply all
Reply to author
Forward
0 new messages