]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: simplify exporting ONAME nodes
authorMatthew Dempsky <mdempsky@google.com>
Tue, 12 Sep 2017 20:36:44 +0000 (13:36 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Wed, 13 Sep 2017 22:07:35 +0000 (22:07 +0000)
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 <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
src/cmd/compile/internal/gc/bexport.go

index 7608d927a579098bdda38ba6683b1c70170fe6cc..596b8f7e833eb05356cd20910929a5e15603a117 100644 (file)
@@ -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.