From de4317cbd705b3dc53bc0ca0b5831568d57b621a Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Fri, 11 Mar 2016 03:25:00 -0800 Subject: [PATCH] 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 TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick Reviewed-by: Robert Griesemer --- src/cmd/compile/internal/gc/bexport.go | 29 +++++++++++++------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/cmd/compile/internal/gc/bexport.go b/src/cmd/compile/internal/gc/bexport.go index 67b0f97c0f..fb42519328 100644 --- a/src/cmd/compile/internal/gc/bexport.go +++ b/src/cmd/compile/internal/gc/bexport.go @@ -471,23 +471,22 @@ func (p *exporter) typ(t *Type) { sort.Sort(methodbyname(methods)) p.int(len(methods)) - if p.trace && t.Method != nil { - p.tracef("associated methods {>\n") + if p.trace && len(methods) > 0 { + p.tracef("associated methods {>") } for _, m := range methods { + if p.trace { + p.tracef("\n") + } p.string(m.Sym.Name) p.paramList(m.Type.Recvs()) p.paramList(m.Type.Params()) p.paramList(m.Type.Results()) 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} ") } @@ -553,17 +552,17 @@ func (p *exporter) qualifiedName(sym *Sym) { } func (p *exporter) fieldList(t *Type) { - if p.trace && t.Type != nil { - p.tracef("fields {>\n") + if p.trace && countfield(t) > 0 { + p.tracef("fields {>") defer p.tracef("<\n} ") } p.int(countfield(t)) for f, it := IterFields(t); f != nil; f = it.Next() { - p.field(f) - if p.trace && f.Down != nil { + if p.trace { p.tracef("\n") } + p.field(f) } } @@ -586,17 +585,17 @@ func (p *exporter) note(n *string) { } func (p *exporter) methodList(t *Type) { - if p.trace && t.Type != nil { - p.tracef("methods {>\n") + if p.trace && countfield(t) > 0 { + p.tracef("methods {>") defer p.tracef("<\n} ") } p.int(countfield(t)) for m, it := IterFields(t); m != nil; m = it.Next() { - p.method(m) - if p.trace && m.Down != nil { + if p.trace { p.tracef("\n") } + p.method(m) } } -- 2.48.1