Commit de4317cb authored by Matthew Dempsky's avatar Matthew Dempsky

cmd/compile: eliminate uses of Type.Down in bexport.go

Change-Id: I298b9d389ac33a24365f4c06a122c3af989906c0
Reviewed-on: https://go-review.googlesource.com/20594
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
parent d9bb6939
...@@ -471,23 +471,22 @@ func (p *exporter) typ(t *Type) { ...@@ -471,23 +471,22 @@ func (p *exporter) typ(t *Type) {
sort.Sort(methodbyname(methods)) sort.Sort(methodbyname(methods))
p.int(len(methods)) p.int(len(methods))
if p.trace && t.Method != nil { if p.trace && len(methods) > 0 {
p.tracef("associated methods {>\n") p.tracef("associated methods {>")
} }
for _, m := range methods { for _, m := range methods {
if p.trace {
p.tracef("\n")
}
p.string(m.Sym.Name) p.string(m.Sym.Name)
p.paramList(m.Type.Recvs()) p.paramList(m.Type.Recvs())
p.paramList(m.Type.Params()) p.paramList(m.Type.Params())
p.paramList(m.Type.Results()) p.paramList(m.Type.Results())
p.inlinedBody(m.Type.Nname) p.inlinedBody(m.Type.Nname)
if p.trace && m.Down != nil {
p.tracef("\n")
}
} }
if p.trace && t.Method != nil { if p.trace && len(methods) > 0 {
p.tracef("<\n} ") p.tracef("<\n} ")
} }
...@@ -553,17 +552,17 @@ func (p *exporter) qualifiedName(sym *Sym) { ...@@ -553,17 +552,17 @@ func (p *exporter) qualifiedName(sym *Sym) {
} }
func (p *exporter) fieldList(t *Type) { func (p *exporter) fieldList(t *Type) {
if p.trace && t.Type != nil { if p.trace && countfield(t) > 0 {
p.tracef("fields {>\n") p.tracef("fields {>")
defer p.tracef("<\n} ") defer p.tracef("<\n} ")
} }
p.int(countfield(t)) p.int(countfield(t))
for f, it := IterFields(t); f != nil; f = it.Next() { for f, it := IterFields(t); f != nil; f = it.Next() {
p.field(f) if p.trace {
if p.trace && f.Down != nil {
p.tracef("\n") p.tracef("\n")
} }
p.field(f)
} }
} }
...@@ -586,17 +585,17 @@ func (p *exporter) note(n *string) { ...@@ -586,17 +585,17 @@ func (p *exporter) note(n *string) {
} }
func (p *exporter) methodList(t *Type) { func (p *exporter) methodList(t *Type) {
if p.trace && t.Type != nil { if p.trace && countfield(t) > 0 {
p.tracef("methods {>\n") p.tracef("methods {>")
defer p.tracef("<\n} ") defer p.tracef("<\n} ")
} }
p.int(countfield(t)) p.int(countfield(t))
for m, it := IterFields(t); m != nil; m = it.Next() { for m, it := IterFields(t); m != nil; m = it.Next() {
p.method(m) if p.trace {
if p.trace && m.Down != nil {
p.tracef("\n") p.tracef("\n")
} }
p.method(m)
} }
} }
......
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