Skip to content

Commit 53647a1

Browse files
committed
cmd/compile: remove ir.TypeNodeAt
It's deprecated and no longer needed. Simplify underlying code while here. Change-Id: I2a6810867d76d8a82ac0d1e6e546a63e6f132736 Reviewed-on: https://go-review.googlesource.com/c/go/+/403836 TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Matthew Dempsky <[email protected]> Reviewed-by: David Chase <[email protected]> Reviewed-by: Cuong Manh Le <[email protected]>
1 parent 14fed2c commit 53647a1

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

src/cmd/compile/internal/ir/type.go

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ type typeNode struct {
158158
typ *types.Type
159159
}
160160

161-
func newTypeNode(pos src.XPos, typ *types.Type) *typeNode {
161+
func newTypeNode(typ *types.Type) *typeNode {
162162
n := &typeNode{typ: typ}
163-
n.pos = pos
163+
n.pos = src.NoXPos
164164
n.op = OTYPE
165165
return n
166166
}
@@ -171,24 +171,13 @@ func (n *typeNode) CanBeNtype() {}
171171

172172
// TypeNode returns the Node representing the type t.
173173
func TypeNode(t *types.Type) Ntype {
174-
return TypeNodeAt(src.NoXPos, t)
175-
}
176-
177-
// TypeNodeAt is like TypeNode, but allows specifying the position
178-
// information if a new OTYPE needs to be constructed.
179-
//
180-
// Deprecated: Use TypeNode instead. For typical use, the position for
181-
// an anonymous OTYPE node should not matter. However, TypeNodeAt is
182-
// available for use with toolstash -cmp to refactor existing code
183-
// that is sensitive to OTYPE position.
184-
func TypeNodeAt(pos src.XPos, t *types.Type) Ntype {
185174
if n := t.Obj(); n != nil {
186175
if n.Type() != t {
187176
base.Fatalf("type skew: %v has type %v, but expected %v", n, n.Type(), t)
188177
}
189178
return n.(Ntype)
190179
}
191-
return newTypeNode(pos, t)
180+
return newTypeNode(t)
192181
}
193182

194183
// A DynamicType represents the target type in a type switch.

0 commit comments

Comments
 (0)