aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/typecheck/func.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2020-12-23 02:16:17 -0800
committerMatthew Dempsky <mdempsky@google.com>2020-12-23 11:59:23 +0000
commitaddade2cce83fb0019ad8394311c51466d4042cf (patch)
tree1eaa446b3032b608295e079efbc7d53b1f5beb75 /src/cmd/compile/internal/typecheck/func.go
parent18ebfb49e9114b98e5a66acae073f5514e383aba (diff)
downloadgo-addade2cce83fb0019ad8394311c51466d4042cf.tar.gz
go-addade2cce83fb0019ad8394311c51466d4042cf.zip
[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>
Diffstat (limited to 'src/cmd/compile/internal/typecheck/func.go')
-rw-r--r--src/cmd/compile/internal/typecheck/func.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/cmd/compile/internal/typecheck/func.go b/src/cmd/compile/internal/typecheck/func.go
index 99d81dcede..fdac719ad9 100644
--- a/src/cmd/compile/internal/typecheck/func.go
+++ b/src/cmd/compile/internal/typecheck/func.go
@@ -73,17 +73,17 @@ func ClosureType(clo *ir.ClosureExpr) *types.Type {
// The information appears in the binary in the form of type descriptors;
// the struct is unnamed so that closures in multiple packages with the
// same struct type can share the descriptor.
- fields := []*ir.Field{
- ir.NewField(base.Pos, Lookup(".F"), nil, types.Types[types.TUINTPTR]),
+ fields := []*types.Field{
+ types.NewField(base.Pos, Lookup(".F"), types.Types[types.TUINTPTR]),
}
for _, v := range clo.Func.ClosureVars {
typ := v.Type()
if !v.Byval() {
typ = types.NewPtr(typ)
}
- fields = append(fields, ir.NewField(base.Pos, v.Sym(), nil, typ))
+ fields = append(fields, types.NewField(base.Pos, v.Sym(), typ))
}
- typ := NewStructType(fields)
+ typ := types.NewStruct(types.NoPkg, fields)
typ.SetNoalg(true)
return typ
}
@@ -92,9 +92,9 @@ func ClosureType(clo *ir.ClosureExpr) *types.Type {
// needed in the closure for n (n must be a OCALLPART node).
// The address of a variable of the returned type can be cast to a func.
func PartialCallType(n *ir.CallPartExpr) *types.Type {
- t := NewStructType([]*ir.Field{
- ir.NewField(base.Pos, Lookup("F"), nil, types.Types[types.TUINTPTR]),
- ir.NewField(base.Pos, Lookup("R"), nil, n.X.Type()),
+ t := types.NewStruct(types.NoPkg, []*types.Field{
+ types.NewField(base.Pos, Lookup("F"), types.Types[types.TUINTPTR]),
+ types.NewField(base.Pos, Lookup("R"), n.X.Type()),
})
t.SetNoalg(true)
return t