From 53647a1994184e471988b53f1a98c02bd6c609df Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Mon, 2 May 2022 17:20:10 -0700 Subject: [PATCH] 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 Run-TryBot: Matthew Dempsky Reviewed-by: David Chase Reviewed-by: Cuong Manh Le --- src/cmd/compile/internal/ir/type.go | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/cmd/compile/internal/ir/type.go b/src/cmd/compile/internal/ir/type.go index b0b9e553b53..39d36b3f4ab 100644 --- a/src/cmd/compile/internal/ir/type.go +++ b/src/cmd/compile/internal/ir/type.go @@ -158,9 +158,9 @@ type typeNode struct { typ *types.Type } -func newTypeNode(pos src.XPos, typ *types.Type) *typeNode { +func newTypeNode(typ *types.Type) *typeNode { n := &typeNode{typ: typ} - n.pos = pos + n.pos = src.NoXPos n.op = OTYPE return n } @@ -171,24 +171,13 @@ func (n *typeNode) CanBeNtype() {} // TypeNode returns the Node representing the type t. func TypeNode(t *types.Type) Ntype { - return TypeNodeAt(src.NoXPos, t) -} - -// TypeNodeAt is like TypeNode, but allows specifying the position -// information if a new OTYPE needs to be constructed. -// -// Deprecated: Use TypeNode instead. For typical use, the position for -// an anonymous OTYPE node should not matter. However, TypeNodeAt is -// available for use with toolstash -cmp to refactor existing code -// that is sensitive to OTYPE position. -func TypeNodeAt(pos src.XPos, t *types.Type) Ntype { if n := t.Obj(); n != nil { if n.Type() != t { base.Fatalf("type skew: %v has type %v, but expected %v", n, n.Type(), t) } return n.(Ntype) } - return newTypeNode(pos, t) + return newTypeNode(t) } // A DynamicType represents the target type in a type switch.