1
0
forked from aniani/vim

patch 9.0.1083: empty and comment lines in a class cause an error

Problem:    Empty and comment lines in a class cause an error.
Solution:   Skip empty and comment lines. (closes #11734)
This commit is contained in:
Bram Moolenaar
2022-12-20 13:38:22 +00:00
parent 104b2ff4d0
commit 418b547881
3 changed files with 14 additions and 0 deletions

View File

@@ -131,6 +131,7 @@ def Test_class_basic()
this.lnum: number this.lnum: number
this.col: number this.col: number
# make a nicely formatted string
def ToString(): string def ToString(): string
return $'({this.lnum}, {this.col})' return $'({this.lnum}, {this.col})'
enddef enddef
@@ -155,6 +156,7 @@ def Test_class_member_initializer()
this.lnum: number = 1 this.lnum: number = 1
this.col: number = 1 this.col: number = 1
# constructor with only the line number
def new(lnum: number) def new(lnum: number)
this.lnum = lnum this.lnum = lnum
enddef enddef

View File

@@ -695,6 +695,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1083,
/**/ /**/
1082, 1082,
/**/ /**/

View File

@@ -248,6 +248,16 @@ ex_class(exarg_T *eap)
break; break;
char_u *line = skipwhite(theline); 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; char_u *p = line;
if (checkforcmd(&p, "endclass", 4)) if (checkforcmd(&p, "endclass", 4))
{ {