Mercurial > vim
changeset 32230:eee30cf13301 v9.0.1446
patch 9.0.1446: unnecessary checks for the "skip" flag when skipping
Commit: https://github.com/vim/vim/commit/5299c0933f942c61bfd48064c91365e518fa868c
Author: zeertzjq <zeertzjq@outlook.com>
Date: Wed Apr 12 20:48:16 2023 +0100
patch 9.0.1446: unnecessary checks for the "skip" flag when skipping
Problem: Unnecessary checks for the "skip" flag when skipping.
Solution: Remove the unnecessary checks. (closes https://github.com/vim/vim/issues/12254)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 12 Apr 2023 22:00:03 +0200 |
parents | bbdf3ccfbc3e |
children | 28d5f8e20ba6 |
files | src/userfunc.c src/version.c |
diffstat | 2 files changed, 11 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/src/userfunc.c +++ b/src/userfunc.c @@ -5868,6 +5868,9 @@ ex_return(exarg_T *eap) clear_evalarg(&evalarg, eap); } +/* + * Lower level implementation of "call". Only called when not skipping. + */ static int ex_call_inner( exarg_T *eap, @@ -5882,24 +5885,12 @@ ex_call_inner( 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; + lnum = eap->line1; for ( ; lnum <= eap->line2; ++lnum) { funcexe_T funcexe; - if (!eap->skip && eap->addr_count > 0) + if (eap->addr_count > 0) { if (lnum > curbuf->b_ml.ml_line_count) { @@ -5927,14 +5918,14 @@ ex_call_inner( // Handle a function returning a Funcref, Dictionary or List. if (handle_subscript(arg, NULL, &rettv, - eap->skip ? NULL : &EVALARG_EVALUATE, TRUE) == FAIL) + &EVALARG_EVALUATE, TRUE) == FAIL) { failed = TRUE; break; } clear_tv(&rettv); - if (doesrange || eap->skip) + if (doesrange) break; // Stop when immediately aborting on error, or when an interrupt @@ -5944,8 +5935,6 @@ ex_call_inner( if (aborting()) break; } - if (eap->skip) - --emsg_skip; return failed; } @@ -6185,7 +6174,7 @@ ex_call(exarg_T *eap) return; } - tofree = trans_function_name_ext(&arg, NULL, eap->skip, TFN_INT, + tofree = trans_function_name_ext(&arg, NULL, FALSE, TFN_INT, &fudi, &partial, vim9script ? &type : NULL, NULL); if (fudi.fd_newkey != NULL) { @@ -6239,7 +6228,7 @@ ex_call(exarg_T *eap) funcexe.fe_firstline = eap->line1; funcexe.fe_lastline = eap->line2; funcexe.fe_found_var = found_var; - funcexe.fe_evaluate = !eap->skip; + funcexe.fe_evaluate = TRUE; failed = ex_call_inner(eap, name, &arg, startarg, &funcexe, &evalarg); }