1
0
mirror of https://github.com/golang/go synced 2024-11-18 02:04:45 -07:00

cmd/compile/internal/gc: split SetInterface from SetFields

Change-Id: I4e568414faf64d3d47b1795382f0615f6caf53bc
Reviewed-on: https://go-review.googlesource.com/38390
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 02:32:42 -07:00
parent df47b82174
commit 236ef852be
4 changed files with 9 additions and 3 deletions

View File

@ -533,7 +533,7 @@ func (p *importer) typ() *Type {
t = Types[TINTER]
} else {
t = p.newtyp(TINTER)
t.SetFields(ml)
t.SetInterface(ml)
}
checkwidth(t)

View File

@ -897,7 +897,7 @@ func tointerface0(t *Type, l []*Node) *Type {
}
}
sort.Sort(methcmp(fields))
t.SetFields(fields)
t.SetInterface(fields)
checkdupfields("method", t)
checkwidth(t)

View File

@ -865,6 +865,7 @@ func (t *Type) FieldSlice() []*Field {
// SetFields sets struct/interface type t's fields/methods to fields.
func (t *Type) SetFields(fields []*Field) {
t.wantEtype(TSTRUCT)
for _, f := range fields {
// If type T contains a field F with a go:notinheap
// type, then T must also be go:notinheap. Otherwise,
@ -879,6 +880,11 @@ func (t *Type) SetFields(fields []*Field) {
t.Fields().Set(fields)
}
func (t *Type) SetInterface(methods []*Field) {
t.wantEtype(TINTER)
t.Fields().Set(methods)
}
func (t *Type) isDDDArray() bool {
if t.Etype != TARRAY {
return false

View File

@ -382,7 +382,7 @@ func makeErrorInterface() *Type {
field.Type = f
t := typ(TINTER)
t.SetFields([]*Field{field})
t.SetInterface([]*Field{field})
return t
}