Skip to content

Commit

Permalink
patch 9.0.1083: empty and comment lines in a class cause an error
Browse files Browse the repository at this point in the history
Problem:    Empty and comment lines in a class cause an error.
Solution:   Skip empty and comment lines. (closes #11734)
  • Loading branch information
brammool committed Dec 20, 2022
1 parent 104b2ff commit 418b547
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/testdir/test_vim9_class.vim
Expand Up @@ -131,6 +131,7 @@ def Test_class_basic()
this.lnum: number
this.col: number

# make a nicely formatted string
def ToString(): string
return $'({this.lnum}, {this.col})'
enddef
Expand All @@ -155,6 +156,7 @@ def Test_class_member_initializer()
this.lnum: number = 1
this.col: number = 1

# constructor with only the line number
def new(lnum: number)
this.lnum = lnum
enddef
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -695,6 +695,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1083,
/**/
1082,
/**/
Expand Down
10 changes: 10 additions & 0 deletions src/vim9class.c
Expand Up @@ -248,6 +248,16 @@ ex_class(exarg_T *eap)
break;
char_u *line = skipwhite(theline);

// Skip empty and comment lines.
if (*line == NUL)
continue;
if (*line == '#')
{
if (vim9_bad_comment(line))
break;
continue;
}

char_u *p = line;
if (checkforcmd(&p, "endclass", 4))
{
Expand Down

0 comments on commit 418b547

Please sign in to comment.