1
0
mirror of https://github.com/golang/go synced 2024-11-17 03:14:50 -07:00

cmd/compile/internal/noder: remove TODO about position handling

types2 uses nopos as the position for predeclared objects, so it's
expected that we'll see !pos.IsKnown() when translating types2
representations into IR.

Change-Id: I8708c2e9815e3dd27da8066c67c73f5586ac4617
Reviewed-on: https://go-review.googlesource.com/c/go/+/406896
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Matthew Dempsky 2022-05-17 15:26:18 -07:00 committed by Gopher Robot
parent d63865b5d1
commit 6382c39e15

View File

@ -26,8 +26,9 @@ func (m *posMap) pos(p poser) src.XPos { return m.makeXPos(p.Pos()) }
func (m *posMap) end(p ender) src.XPos { return m.makeXPos(p.End()) }
func (m *posMap) makeXPos(pos syntax.Pos) src.XPos {
// Predeclared objects (e.g., the result parameter for error.Error)
// do not have a position.
if !pos.IsKnown() {
// TODO(mdempsky): Investigate restoring base.Fatalf.
return src.NoXPos
}