From: Matthew Dempsky Date: Tue, 12 Sep 2017 20:36:44 +0000 (-0700) Subject: cmd/compile: simplify exporting ONAME nodes X-Git-Tag: go1.10beta1~1108 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=c64e7938505fb31ab869d9305b8e15781bc426ce;p=gostls13.git cmd/compile: simplify exporting ONAME nodes These two special cases are unnecessary: 1) "~b%d" references only appear during walk, to handle "return" statements implicitly assigning to blank result parameters. Even if they could appear, the "inlined and customized version" accidentally diverged from p.sym in golang.org/cl/33911. 2) The Vargen case is already identical to the default case, and it never overlaps with the remaining "T.method" case. Passes toolstash-check. Change-Id: I03f7e5b75b707b43afc8ed6eb90f43ba93ed17ae Reviewed-on: https://go-review.googlesource.com/63272 Run-TryBot: Matthew Dempsky TryBot-Result: Gobot Gobot Reviewed-by: Alan Donovan --- diff --git a/src/cmd/compile/internal/gc/bexport.go b/src/cmd/compile/internal/gc/bexport.go index 7608d927a5..596b8f7e83 100644 --- a/src/cmd/compile/internal/gc/bexport.go +++ b/src/cmd/compile/internal/gc/bexport.go @@ -1190,22 +1190,6 @@ func (p *exporter) expr(n *Node) { p.value(n.Val()) case ONAME: - // Special case: name used as local variable in export. - // _ becomes ~b%d internally; print as _ for export - if n.Sym != nil && n.Sym.Name[0] == '~' && n.Sym.Name[1] == 'b' { - p.op(ONAME) - p.pos(n) - p.string("_") // inlined and customized version of p.sym(n) - break - } - - if n.Sym != nil && !isblank(n) && n.Name.Vargen > 0 { - p.op(ONAME) - p.pos(n) - p.sym(n) - break - } - // Special case: explicit name of func (*T) method(...) is turned into pkg.(*T).method, // but for export, this should be rendered as (*pkg.T).meth. // These nodes have the special property that they are names with a left OTYPE and a right ONAME.