1
0
mirror of https://github.com/golang/go synced 2024-11-17 05:44:52 -07:00

cmd/compile: remove ir.Field.Ntype

It's never assigned/initialized, so replace all uses with nil.

Change-Id: If224075aab925536114d4ff77b3aaf6b4659c983
Reviewed-on: https://go-review.googlesource.com/c/go/+/403835
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
Matthew Dempsky 2022-05-02 17:15:59 -07:00
parent 73fb829f59
commit 14fed2c8f1
3 changed files with 4 additions and 21 deletions

View File

@ -85,7 +85,6 @@ func (n *FuncType) SetOTYPE(t *types.Type) {
type Field struct {
Pos src.XPos
Sym *types.Sym
Ntype Ntype
Type *types.Type
Embedded bool
IsDDD bool
@ -94,20 +93,14 @@ type Field struct {
}
func NewField(pos src.XPos, sym *types.Sym, typ *types.Type) *Field {
return &Field{Pos: pos, Sym: sym, Ntype: nil, Type: typ}
return &Field{Pos: pos, Sym: sym, Type: typ}
}
func (f *Field) String() string {
var typ string
if f.Type != nil {
typ = fmt.Sprint(f.Type)
} else {
typ = fmt.Sprint(f.Ntype)
}
if f.Sym != nil {
return fmt.Sprintf("%v %v", f.Sym, typ)
return fmt.Sprintf("%v %v", f.Sym, f.Type)
}
return typ
return fmt.Sprint(f.Type)
}
// TODO(mdempsky): Make Field a Node again so these can be generated?
@ -127,9 +120,6 @@ func doField(f *Field, do func(Node) bool) bool {
if f.Decl != nil && do(f.Decl) {
return true
}
if f.Ntype != nil && do(f.Ntype) {
return true
}
return false
}
func editField(f *Field, edit func(Node) Node) {
@ -139,9 +129,6 @@ func editField(f *Field, edit func(Node) Node) {
if f.Decl != nil {
f.Decl = edit(f.Decl).(*Name)
}
if f.Ntype != nil {
f.Ntype = edit(f.Ntype).(Ntype)
}
}
func copyFields(list []*Field) []*Field {

View File

@ -202,7 +202,7 @@ func funcarg(n *ir.Field, ctxt ir.Class) {
name := ir.NewNameAt(n.Pos, n.Sym)
n.Decl = name
name.Ntype = n.Ntype
name.Ntype = nil
Declare(name, ctxt)
}

View File

@ -40,10 +40,6 @@ func tcFuncType(n *ir.FuncType) ir.Node {
// misc can be provided to handle specialized typechecking.
func tcField(n *ir.Field, misc func(*types.Field, *ir.Field)) *types.Field {
base.Pos = n.Pos
if n.Ntype != nil {
n.Type = typecheckNtype(n.Ntype).Type()
n.Ntype = nil
}
f := types.NewField(n.Pos, n.Sym, n.Type)
if misc != nil {
misc(f, n)