Commit 08e342d6 authored by Robert Griesemer's avatar Robert Griesemer

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: 's avatarMatthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 40a17eed
......@@ -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 {
......
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