diff options
| author | Matthew Dempsky <mdempsky@google.com> | 2022-02-01 17:41:46 -0800 |
|---|---|---|
| committer | Matthew Dempsky <mdempsky@google.com> | 2022-03-01 07:36:46 +0000 |
| commit | 21998413ad82655fef1f31316db31e23e0684b21 (patch) | |
| tree | a2dfae21bd7762afcd003b4e1a34d2dfcd6645d3 /src/cmd/compile/internal/noder/writer.go | |
| parent | 7c151f328056c354d3db13c17b3d96bec316cff6 (diff) | |
| download | go-21998413ad82655fef1f31316db31e23e0684b21.tar.xz | |
cmd/compile: unified IR support for implicit interfaces
Change-Id: Ibdaa0750f7bc47b513c047fdf4b7145ebba9e870
Reviewed-on: https://go-review.googlesource.com/c/go/+/386001
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/noder/writer.go')
| -rw-r--r-- | src/cmd/compile/internal/noder/writer.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/noder/writer.go b/src/cmd/compile/internal/noder/writer.go index 432a2a7195..59e9409b97 100644 --- a/src/cmd/compile/internal/noder/writer.go +++ b/src/cmd/compile/internal/noder/writer.go @@ -396,6 +396,15 @@ func (w *writer) interfaceType(typ *types2.Interface) { w.Len(typ.NumExplicitMethods()) w.Len(typ.NumEmbeddeds()) + if typ.NumExplicitMethods() == 0 && typ.NumEmbeddeds() == 1 { + w.Bool(typ.IsImplicit()) + } else { + // Implicit interfaces always have 0 explicit methods and 1 + // embedded type, so we skip writing out the implicit flag + // otherwise as a space optimization. + assert(!typ.IsImplicit()) + } + for i := 0; i < typ.NumExplicitMethods(); i++ { m := typ.ExplicitMethod(i) sig := m.Type().(*types2.Signature) |
