cmd/compile/internal/gc: export interface embedding information

Fixes #16369.

Change-Id: I23f8c36370d0da37ac5b5126d012d22f78782782
Reviewed-on: https://go-review.googlesource.com/38392
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
Matthew Dempsky 2017-03-20 12:14:16 -07:00
parent 07de3465be
commit ee272bbf36
5 changed files with 50 additions and 52 deletions

View file

@ -526,9 +526,6 @@ func (p *importer) typ() *Type {
functypefield0(t, nil, params, result)
case interfaceTag:
if p.int() != 0 {
formatErrorf("unexpected embedded interface")
}
if ml := p.methodList(); len(ml) == 0 {
t = Types[TINTER]
} else {
@ -604,12 +601,18 @@ func (p *importer) field() *Field {
}
func (p *importer) methodList() (methods []*Field) {
if n := p.int(); n > 0 {
methods = make([]*Field, n)
for i := range methods {
methods[i] = p.method()
}
for n := p.int(); n > 0; n-- {
f := newField()
f.Nname = newname(nblank.Sym)
f.Nname.Pos = p.pos()
f.Type = p.typ()
methods = append(methods, f)
}
for n := p.int(); n > 0; n-- {
methods = append(methods, p.method())
}
return
}