cmd/compile/internal/types: overhaul and simplify API

This CL removes a lot of the redundant methods for accessing struct
fields and signature parameters. In particular, users never have to
write ".Slice()" or ".FieldSlice()" anymore; the exported APIs just do
what you want.

Further internal refactorings to follow.

Change-Id: I45212f6772fe16aad39d0e68b82d71b0796e5639
Reviewed-on: https://go-review.googlesource.com/c/go/+/521295
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: Austin Clements <austin@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Matthew Dempsky 2023-08-20 10:05:29 -07:00 committed by Gopher Robot
parent fecf51717f
commit 14f5eb7f31
36 changed files with 241 additions and 329 deletions

View file

@ -142,9 +142,9 @@ func staticCall(call *ir.CallExpr) {
switch ft := x.Type(); ft.NumResults() {
case 0:
case 1:
call.SetType(ft.Results().Field(0).Type)
call.SetType(ft.Result(0).Type)
default:
call.SetType(ft.Results())
call.SetType(ft.ResultsTuple())
}
// Desugar OCALLMETH, if we created one (#57309).