aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types/size.go
diff options
context:
space:
mode:
authorDan Scales <danscales@google.com>2021-04-02 16:52:58 -0700
committerDan Scales <danscales@google.com>2021-04-05 15:30:15 +0000
commita4b8241d97fb180e1b9cb41c4828345c931d1aaf (patch)
treec38279cd1a5493824af9384b7cd8765cea58a63b /src/cmd/compile/internal/types/size.go
parent6ed045b365731e59fcae48de48f1aea7a6304eb3 (diff)
downloadgo-a4b8241d97fb180e1b9cb41c4828345c931d1aaf.tar.gz
go-a4b8241d97fb180e1b9cb41c4828345c931d1aaf.zip
cmd/compile: get rid of Fields in types.Interface, use allMethods in types.Type instead
Confusingly, the set of all methods of an interface is currently set in Fields field of types.Interface. This is true, even though there is already an allMethods field (and AllMethods method) of types.Type. Change so the set of all methods of an interface are stored in Type.allMethods, and Interface.Fields is removed. Update the comments for Methods and AllMethods. Change-Id: Ibc32bafae86831cba62606b079a855690612c759 Reviewed-on: https://go-review.googlesource.com/c/go/+/307209 Run-TryBot: Dan Scales <danscales@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Dan Scales <danscales@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/types/size.go')
-rw-r--r--src/cmd/compile/internal/types/size.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/cmd/compile/internal/types/size.go b/src/cmd/compile/internal/types/size.go
index a75429f0ab..f0e695ab96 100644
--- a/src/cmd/compile/internal/types/size.go
+++ b/src/cmd/compile/internal/types/size.go
@@ -119,7 +119,7 @@ func expandiface(t *Type) {
// Embedded interface: duplicate all methods
// (including broken ones, if any) and add to t's
// method set.
- for _, t1 := range m.Type.Fields().Slice() {
+ for _, t1 := range m.Type.AllMethods().Slice() {
// Use m.Pos rather than t1.Pos to preserve embedding position.
f := NewField(m.Pos, t1.Sym, t1.Type)
addMethod(f, false)
@@ -135,9 +135,7 @@ func expandiface(t *Type) {
m.Offset = int64(i) * int64(PtrSize)
}
- // Access fields directly to avoid recursively calling CalcSize
- // within Type.Fields().
- t.Extra.(*Interface).Fields.Set(methods)
+ t.SetAllMethods(methods)
}
func calcStructOffset(errtype *Type, t *Type, o int64, flag int) int64 {