Commit c37090f0 authored by griesemer's avatar griesemer Committed by Robert Griesemer

cmd/compile/internal/parser: use same logic for stmtList as for other lists (cleanup)

Change-Id: I2c2571b33603f0fd0ba5a79400da7b845d246b8c
Reviewed-on: https://go-review.googlesource.com/71290Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
parent 47193dcc
...@@ -2063,14 +2063,11 @@ func (p *parser) stmtList() (l []Stmt) { ...@@ -2063,14 +2063,11 @@ func (p *parser) stmtList() (l []Stmt) {
break break
} }
l = append(l, s) l = append(l, s)
// customized version of osemi: // ";" is optional before "}"
// ';' is optional before a closing ')' or '}' if !p.got(_Semi) && p.tok != _Rbrace {
if p.tok == _Rparen || p.tok == _Rbrace {
continue
}
if !p.got(_Semi) {
p.syntax_error("at end of statement") p.syntax_error("at end of statement")
p.advance(_Semi, _Rbrace) p.advance(_Semi, _Rbrace, _Case, _Default)
p.got(_Semi) // avoid spurious empty statement
} }
} }
return return
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment