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: 's avatarMatthew Dempsky <mdempsky@google.com>
parent 47193dcc
......@@ -2063,14 +2063,11 @@ func (p *parser) stmtList() (l []Stmt) {
break
}
l = append(l, s)
// customized version of osemi:
// ';' is optional before a closing ')' or '}'
if p.tok == _Rparen || p.tok == _Rbrace {
continue
}
if !p.got(_Semi) {
// ";" is optional before "}"
if !p.got(_Semi) && p.tok != _Rbrace {
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
......
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