]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.regabi] cmd/compile/internal/types: remove Func.Nname
authorMatthew Dempsky <mdempsky@google.com>
Mon, 23 Nov 2020 04:45:42 +0000 (20:45 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Tue, 24 Nov 2020 01:34:39 +0000 (01:34 +0000)
Now that there's no code remaining that uses Func.Nname, we can get
rid of it along with the remaining code that uselessly assigns to it.

Passes toolstash-check.

Change-Id: I104ab3bb5122fb824c741bc6e4d9d54fefe5646e
Reviewed-on: https://go-review.googlesource.com/c/go/+/272390
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/compile/internal/gc/export.go
src/cmd/compile/internal/gc/inl.go
src/cmd/compile/internal/gc/reflect.go
src/cmd/compile/internal/gc/typecheck.go
src/cmd/compile/internal/types/sizeof_test.go
src/cmd/compile/internal/types/type.go

index c6917e0f810ddb66ee9e8edef76f8e172b9a8cb4..5179b6c05be58ee4c8561daf7efdc1bb96a0125f 100644 (file)
@@ -164,7 +164,6 @@ func importfunc(ipkg *types.Pkg, pos src.XPos, s *types.Sym, t *types.Type) {
        }
 
        n.Func = new(Func)
-       t.SetNname(asTypesNode(n))
 
        if Debug.E != 0 {
                fmt.Printf("import func %v%S\n", s, t)
index 4908dc446366615c269ac0d6d2d032847d67ef54..4aa561da6e9eb2a2305372024473e1eecedfa381 100644 (file)
@@ -221,10 +221,6 @@ func caninl(fn *Node) {
                Body: inlcopylist(fn.Nbody.Slice()),
        }
 
-       // hack, TODO, check for better way to link method nodes back to the thing with the ->inl
-       // this is so export can find the body of a method
-       fn.Type.FuncType().Nname = asTypesNode(n)
-
        if Debug.m > 1 {
                fmt.Printf("%v: can inline %#v with cost %d as: %#v { %#v }\n", fn.Line(), n, inlineMaxBudget-visitor.budget, fn.Type, asNodes(n.Func.Inl.Body))
        } else if Debug.m != 0 {
index 05e476b76b2335a594bdbde985fd174e30119a71..1ac7a8490f6caf972abe156457bdb97e8a359aa0 100644 (file)
@@ -365,13 +365,7 @@ func methodfunc(f *types.Type, receiver *types.Type) *types.Type {
                out = append(out, d)
        }
 
-       t := functype(nil, in, out)
-       if f.Nname() != nil {
-               // Link to name of original method function.
-               t.SetNname(f.Nname())
-       }
-
-       return t
+       return functype(nil, in, out)
 }
 
 // methods returns the methods of the non-interface type t, sorted by name.
index 53a547c3bbc07cd448189934f832bdb566c21a5a..391115637ed1b095fd3094da5766b95fe4e0544a 100644 (file)
@@ -3409,7 +3409,6 @@ func typecheckfunc(n *Node) {
                return
        }
        n.Type = t
-       t.FuncType().Nname = asTypesNode(n.Func.Nname)
        rcvr := t.Recv()
        if rcvr != nil && n.Func.Shortname != nil {
                m := addmethod(n, n.Func.Shortname, t, true, n.Func.Pragma&Nointerface != 0)
index ea947d8f417c5f08fb5150144330a083521f7145..0cf343e8f13a838cbc7a4cb518cb2dd62888f316 100644 (file)
@@ -24,7 +24,7 @@ func TestSizeof(t *testing.T) {
                {Type{}, 52, 88},
                {Map{}, 20, 40},
                {Forward{}, 20, 32},
-               {Func{}, 32, 56},
+               {Func{}, 28, 48},
                {Struct{}, 16, 32},
                {Interface{}, 8, 16},
                {Chan{}, 8, 16},
index c6d14e9e0981d0f51456671da221567e117f0ef5..62c5c344845ad27f43d6b7b0446162e245e73ed1 100644 (file)
@@ -247,8 +247,7 @@ type Func struct {
        Results  *Type // function results
        Params   *Type // function params
 
-       Nname *Node
-       pkg   *Pkg
+       pkg *Pkg
 
        // Argwid is the total width of the function receiver, params, and results.
        // It gets calculated via a temporary TFUNCARGS type.
@@ -807,26 +806,6 @@ func (t *Type) FuncArgs() *Type {
        return t.Extra.(FuncArgs).T
 }
 
-// Nname returns the associated function's nname.
-func (t *Type) Nname() *Node {
-       switch t.Etype {
-       case TFUNC:
-               return t.Extra.(*Func).Nname
-       }
-       Fatalf("Type.Nname %v %v", t.Etype, t)
-       return nil
-}
-
-// Nname sets the associated function's nname.
-func (t *Type) SetNname(n *Node) {
-       switch t.Etype {
-       case TFUNC:
-               t.Extra.(*Func).Nname = n
-       default:
-               Fatalf("Type.SetNname %v %v", t.Etype, t)
-       }
-}
-
 // IsFuncArgStruct reports whether t is a struct representing function parameters.
 func (t *Type) IsFuncArgStruct() bool {
        return t.Etype == TSTRUCT && t.Extra.(*Struct).Funarg != FunargNone