Christ van Willegen wrote:
> On Tue, May 18, 2021 at 1:41 PM Bram Moolenaar <[email protected]> wrote: > > *** ../vim-8.2.2864/src/userfunc.c 2021-05-18 11:47:31.884191326 +0200 > > --- src/userfunc.c 2021-05-18 13:37:35.985264203 +0200 > > *************** > > *** 4014,4020 **** > > // Save the starting line number. > > sourcing_lnum_top = SOURCING_LNUM; > > > > ! if (get_function_body(eap, &newlines, line_arg, &line_to_free) == > > FAIL) > > goto erret; > > > > /* > > --- 4014,4023 ---- > > // Save the starting line number. > > sourcing_lnum_top = SOURCING_LNUM; > > > > ! // Do not define the function when getting the body fails and when > > ! // skipping. > > ! if (get_function_body(eap, &newlines, line_arg, &line_to_free) == FAIL > > ! || eap->skip) > > goto erret; > > Reversing this condition (so, re-writing it to > > if (eap->skip || > get_function_body(eap, &newlines, line_arg, &line_to_free) == FAIL > > ) would make this case faster, and really skip getting the function > body. Or do you _need_ to get the function body here in order to go to > the correct spot in the script?? When skipping it does need to get the function body to find the end. But then it should not do anything, that's what is being fixed here. Previously get_function_body() would return FAIL when everything is OK but skipping, which is quite confusing. What is still confusing perhaps is jumping to "erret", which suggests there is an error. Could add an "okret" label in the same place, but the comment should already explain it. -- Experience is what you get when you don't get what you want. /// 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/202105181336.14IDalGK4060719%40masaka.moolenaar.net.
