mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00: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
1 changed files with 7 additions and 3 deletions
|
|
@ -1768,9 +1768,13 @@ func (p *parser) header(keyword token) (init SimpleStmt, cond Expr, post SimpleS
|
||||||
lit string // valid if pos.IsKnown()
|
lit string // valid if pos.IsKnown()
|
||||||
}
|
}
|
||||||
if p.tok != _Lbrace {
|
if p.tok != _Lbrace {
|
||||||
semi.pos = p.pos()
|
if p.tok == _Semi {
|
||||||
semi.lit = p.lit
|
semi.pos = p.pos()
|
||||||
p.want(_Semi)
|
semi.lit = p.lit
|
||||||
|
p.next()
|
||||||
|
} else {
|
||||||
|
p.want(_Semi)
|
||||||
|
}
|
||||||
if keyword == _For {
|
if keyword == _For {
|
||||||
if p.tok != _Semi {
|
if p.tok != _Semi {
|
||||||
if p.tok == _Lbrace {
|
if p.tok == _Lbrace {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue