File tree Expand file tree Collapse file tree 1 file changed +21
-22
lines changed Expand file tree Collapse file tree 1 file changed +21
-22
lines changed Original file line number Diff line number Diff line change @@ -345,30 +345,29 @@ func (p *parser) expectClosing(tok token.Token, context string) token.Pos {
345
345
346
346
// expectSemi consumes a semicolon and returns the applicable line comment.
347
347
func (p * parser ) expectSemi () (comment * ast.CommentGroup ) {
348
- // semicolon is optional before a closing ')' or '}'
349
- if p .tok != token .RPAREN && p .tok != token .RBRACE {
350
- switch p .tok {
351
- case token .COMMA :
352
- // permit a ',' instead of a ';' but complain
353
- p .errorExpected (p .pos , "';'" )
354
- fallthrough
355
- case token .SEMICOLON :
356
- if p .lit == ";" {
357
- // explicit semicolon
358
- p .next ()
359
- comment = p .lineComment // use following comments
360
- } else {
361
- // artificial semicolon
362
- comment = p .lineComment // use preceding comments
363
- p .next ()
364
- }
365
- return comment
366
- default :
367
- p .errorExpected (p .pos , "';'" )
368
- p .advance (stmtStart )
348
+ switch p .tok {
349
+ case token .RPAREN , token .RBRACE :
350
+ return nil // semicolon is optional before a closing ')' or '}'
351
+ case token .COMMA :
352
+ // permit a ',' instead of a ';' but complain
353
+ p .errorExpected (p .pos , "';'" )
354
+ fallthrough
355
+ case token .SEMICOLON :
356
+ if p .lit == ";" {
357
+ // explicit semicolon
358
+ p .next ()
359
+ comment = p .lineComment // use following comments
360
+ } else {
361
+ // artificial semicolon
362
+ comment = p .lineComment // use preceding comments
363
+ p .next ()
369
364
}
365
+ return comment
366
+ default :
367
+ p .errorExpected (p .pos , "';'" )
368
+ p .advance (stmtStart )
369
+ return nil
370
370
}
371
- return nil
372
371
}
373
372
374
373
func (p * parser ) atComma (context string , follow token.Token ) bool {
You can’t perform that action at this time.
0 commit comments