]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove ir.NewField's ntyp parameter
authorMatthew Dempsky <mdempsky@google.com>
Tue, 3 May 2022 00:13:50 +0000 (17:13 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Thu, 5 May 2022 18:47:47 +0000 (18:47 +0000)
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>

src/cmd/compile/internal/ir/type.go
src/cmd/compile/internal/reflectdata/alg.go
src/cmd/compile/internal/reflectdata/reflect.go
src/cmd/compile/internal/typecheck/subr.go

index f8aa35da4cb309619f3daf6fd941cacea3089826..d810a6d60dd9b72cc119f2c766bbd58bd6f0c96e 100644 (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 {
index de23387ca1c923e24ee7c81040228cc782ea6d7a..0ed3eb2875f1090b2a125613d36b674a3a5d8e5a 100644 (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)
index d6e6b115a462a9cdde12fb2e5af5f35e9b9b0753..1804eaefe60417058b5655e6a0a623d46a075eb8 100644 (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))
 
index af16e826bd6ac097225db2a5599d5fe0983bb18b..8cd81cf12b9e4572113165dd81e96bd0d9665b29 100644 (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)