Patch 8.2.2865

7 views
Skip to first unread message

Bram Moolenaar

unread,
May 18, 2021, 7:41:39 AM5/18/21
to vim...@googlegroups.com

Patch 8.2.2865 (after 8.2.2864)
Problem: Skipping over function body fails.
Solution: Do not define the function when skipping.
Files: src/userfunc.c


*** ../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;

/*
*** ../vim-8.2.2864/src/version.c 2021-05-18 11:47:31.884191326 +0200
--- src/version.c 2021-05-18 13:38:44.428947971 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2865,
/**/

--
The psychic said, "God bless you." I said, "I didn't sneeze." She
looked deep into my eyes and said, "You will, eventually." And, damn
if she wasn't right. Two days later, I sneezed. --Ellen Degeneres

/// 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 ///

Christ van Willegen

unread,
May 18, 2021, 9:24:42 AM5/18/21
to vim...@googlegroups.com
Hi,


On Tue, May 18, 2021 at 1:41 PM Bram Moolenaar <Br...@moolenaar.net> 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??

Christ van Willegen

Bram Moolenaar

unread,
May 18, 2021, 9:36:53 AM5/18/21
to vim...@googlegroups.com, Christ van Willegen
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.
Reply all
Reply to author
Forward
0 new messages