mirror of
https://github.com/golang/go
synced 2024-11-17 16:04:47 -07:00
cmd/compile/internal/syntax: don't record semi position if there's none
Fixes #23406. Change-Id: Ief04e20357c9ca03a5e496f1742428394c8ee658 Reviewed-on: https://go-review.googlesource.com/87317 Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
40a17eed93
commit
08e342d62c
@ -1768,9 +1768,13 @@ func (p *parser) header(keyword token) (init SimpleStmt, cond Expr, post SimpleS
|
||||
lit string // valid if pos.IsKnown()
|
||||
}
|
||||
if p.tok != _Lbrace {
|
||||
semi.pos = p.pos()
|
||||
semi.lit = p.lit
|
||||
p.want(_Semi)
|
||||
if p.tok == _Semi {
|
||||
semi.pos = p.pos()
|
||||
semi.lit = p.lit
|
||||
p.next()
|
||||
} else {
|
||||
p.want(_Semi)
|
||||
}
|
||||
if keyword == _For {
|
||||
if p.tok != _Semi {
|
||||
if p.tok == _Lbrace {
|
||||
|
Loading…
Reference in New Issue
Block a user