Skip to content

Commit

Permalink
Merge pull request #1775 from visualfc/walk2
Browse files Browse the repository at this point in the history
ast: fix forPhrase.end
  • Loading branch information
xushiwei committed Feb 23, 2024
2 parents 05a2651 + d9d7d4d commit 36d3812
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ast/ast_gop.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,12 @@ type ForPhrase struct {
func (p *ForPhrase) Pos() token.Pos { return p.For }

// End returns position of first character immediately after the node.
func (p *ForPhrase) End() token.Pos { return p.X.End() }
func (p *ForPhrase) End() token.Pos {
if p.Cond != nil {
return p.Cond.End()
}
return p.X.End()
}

func (p *ForPhrase) exprNode() {}

Expand Down

0 comments on commit 36d3812

Please sign in to comment.