[dev.regabi] cmd/compile: prefer types constructors over typecheck

Similar to the earlier mkbuiltin cleanup, there's a bunch of code that
calls typecheck.NewFuncType or typecheck.NewStructType, which can now
just call types.NewSignature and types.NewStruct, respectively.

Passes toolstash -cmp.

Change-Id: Ie6e09f1a7efef84b9a2bb5daa7087a6879979668
Reviewed-on: https://go-review.googlesource.com/c/go/+/279955
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
This commit is contained in:
Matthew Dempsky 2020-12-23 02:16:17 -08:00
parent 18ebfb49e9
commit addade2cce
6 changed files with 47 additions and 47 deletions

View file

@ -289,11 +289,11 @@ func hashfor(t *types.Type) ir.Node {
n := typecheck.NewName(sym)
ir.MarkFunc(n)
n.SetType(typecheck.NewFuncType(nil, []*ir.Field{
ir.NewField(base.Pos, nil, nil, types.NewPtr(t)),
ir.NewField(base.Pos, nil, nil, types.Types[types.TUINTPTR]),
}, []*ir.Field{
ir.NewField(base.Pos, nil, nil, types.Types[types.TUINTPTR]),
n.SetType(types.NewSignature(types.NoPkg, nil, []*types.Field{
types.NewField(base.Pos, nil, types.NewPtr(t)),
types.NewField(base.Pos, nil, types.Types[types.TUINTPTR]),
}, []*types.Field{
types.NewField(base.Pos, nil, types.Types[types.TUINTPTR]),
}))
return n
}
@ -777,12 +777,12 @@ func hashmem(t *types.Type) ir.Node {
n := typecheck.NewName(sym)
ir.MarkFunc(n)
n.SetType(typecheck.NewFuncType(nil, []*ir.Field{
ir.NewField(base.Pos, nil, nil, types.NewPtr(t)),
ir.NewField(base.Pos, nil, nil, types.Types[types.TUINTPTR]),
ir.NewField(base.Pos, nil, nil, types.Types[types.TUINTPTR]),
}, []*ir.Field{
ir.NewField(base.Pos, nil, nil, types.Types[types.TUINTPTR]),
n.SetType(types.NewSignature(types.NoPkg, nil, []*types.Field{
types.NewField(base.Pos, nil, types.NewPtr(t)),
types.NewField(base.Pos, nil, types.Types[types.TUINTPTR]),
types.NewField(base.Pos, nil, types.Types[types.TUINTPTR]),
}, []*types.Field{
types.NewField(base.Pos, nil, types.Types[types.TUINTPTR]),
}))
return n
}