Commit 236ef852 authored by Matthew Dempsky's avatar Matthew Dempsky

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: default avatarRobert Griesemer <gri@golang.org>
parent df47b821
......@@ -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)
......
......@@ -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)
......
......@@ -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
......
......@@ -382,7 +382,7 @@ func makeErrorInterface() *Type {
field.Type = f
t := typ(TINTER)
t.SetFields([]*Field{field})
t.SetInterface([]*Field{field})
return t
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment