Commit 58cf881c authored by griesemer's avatar griesemer Committed by Robert Griesemer

cmd/compile/internal/parser: removed TODO (cleanup)

When an opening "{" of a block is missing and after advancing we
find a closing "}", it's likely better to assume the end of the
block. Fixed and removed TODO.

Change-Id: I20c9b4ecca798933a7cd4cbf21185bd4ca04f5f7
Reviewed-on: https://go-review.googlesource.com/71291Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
parent c37090f0
......@@ -1689,10 +1689,14 @@ func (p *parser) blockStmt(context string) *BlockStmt {
s := new(BlockStmt)
s.pos = p.pos()
// people coming from C may forget that braces are mandatory in Go
if !p.got(_Lbrace) {
p.syntax_error("expecting { after " + context)
p.advance(_Name, _Rbrace)
// TODO(gri) may be better to return here than to continue (#19663)
s.Rbrace = p.pos() // in case we found "}"
if p.got(_Rbrace) {
return s
}
}
s.List = p.stmtList()
......
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