mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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/71291
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
c37090f00f
commit
58cf881c1c
1 changed files with 5 additions and 1 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue