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

cmd/compile: remove ir.NewField's ntyp parameter

ir.NewField is always called with ntyp as nil.

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

View File

@ -93,8 +93,8 @@ type Field struct {
Decl *Name
}
func NewField(pos src.XPos, sym *types.Sym, ntyp Ntype, typ *types.Type) *Field {
return &Field{Pos: pos, Sym: sym, Ntype: ntyp, Type: typ}
func NewField(pos src.XPos, sym *types.Sym, typ *types.Type) *Field {
return &Field{Pos: pos, Sym: sym, Ntype: nil, Type: typ}
}
func (f *Field) String() string {

View File

@ -129,10 +129,10 @@ func genhash(t *types.Type) *obj.LSym {
// func sym(p *T, h uintptr) uintptr
args := []*ir.Field{
ir.NewField(base.Pos, typecheck.Lookup("p"), nil, types.NewPtr(t)),
ir.NewField(base.Pos, typecheck.Lookup("h"), nil, types.Types[types.TUINTPTR]),
ir.NewField(base.Pos, typecheck.Lookup("p"), types.NewPtr(t)),
ir.NewField(base.Pos, typecheck.Lookup("h"), types.Types[types.TUINTPTR]),
}
results := []*ir.Field{ir.NewField(base.Pos, nil, nil, types.Types[types.TUINTPTR])}
results := []*ir.Field{ir.NewField(base.Pos, nil, types.Types[types.TUINTPTR])}
tfn := ir.NewFuncType(base.Pos, nil, args, results)
fn := typecheck.DeclFunc(sym, tfn)
@ -359,8 +359,8 @@ func geneq(t *types.Type) *obj.LSym {
// func sym(p, q *T) bool
tfn := ir.NewFuncType(base.Pos, nil,
[]*ir.Field{ir.NewField(base.Pos, typecheck.Lookup("p"), nil, types.NewPtr(t)), ir.NewField(base.Pos, typecheck.Lookup("q"), nil, types.NewPtr(t))},
[]*ir.Field{ir.NewField(base.Pos, typecheck.Lookup("r"), nil, types.Types[types.TBOOL])})
[]*ir.Field{ir.NewField(base.Pos, typecheck.Lookup("p"), types.NewPtr(t)), ir.NewField(base.Pos, typecheck.Lookup("q"), types.NewPtr(t))},
[]*ir.Field{ir.NewField(base.Pos, typecheck.Lookup("r"), types.Types[types.TBOOL])})
fn := typecheck.DeclFunc(sym, tfn)
np := ir.AsNode(tfn.Type().Params().Field(0).Nname)

View File

@ -1856,7 +1856,7 @@ func methodWrapper(rcvr *types.Type, method *types.Field, forItab bool) *obj.LSy
typecheck.DeclContext = ir.PEXTERN
tfn := ir.NewFuncType(base.Pos,
ir.NewField(base.Pos, typecheck.Lookup(".this"), nil, rcvr),
ir.NewField(base.Pos, typecheck.Lookup(".this"), rcvr),
typecheck.NewFuncParams(method.Type.Params(), true),
typecheck.NewFuncParams(method.Type.Results(), false))

View File

@ -40,7 +40,7 @@ func NewFuncParams(tl *types.Type, mustname bool) []*ir.Field {
// TODO(mdempsky): Preserve original position, name, and package.
s = Lookup(s.Name)
}
a := ir.NewField(base.Pos, s, nil, t.Type)
a := ir.NewField(base.Pos, s, t.Type)
a.Pos = t.Pos
a.IsDDD = t.IsDDD()
args = append(args, a)