[dev.regabi] cmd/compile/internal/types: remove Func.Nname

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>
This commit is contained in:
Matthew Dempsky 2020-11-22 20:45:42 -08:00
parent c50c7a8c06
commit c754f25241
6 changed files with 3 additions and 36 deletions

View 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)

View 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 {

View 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.

View 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)

View 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},

View 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