]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove ir.TypeNodeAt
authorMatthew Dempsky <mdempsky@google.com>
Tue, 3 May 2022 00:20:10 +0000 (17:20 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Thu, 5 May 2022 18:48:01 +0000 (18:48 +0000)
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 <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
src/cmd/compile/internal/ir/type.go

index b0b9e553b533688fb655d02f0f9171210d534684..39d36b3f4abf743a7cb3b6eb5b937819221d1b76 100644 (file)
@@ -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.