Commit c64e7938 authored by Matthew Dempsky's avatar Matthew Dempsky

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 <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarAlan Donovan <adonovan@google.com>
parent 3098cf01
...@@ -1190,22 +1190,6 @@ func (p *exporter) expr(n *Node) { ...@@ -1190,22 +1190,6 @@ func (p *exporter) expr(n *Node) {
p.value(n.Val()) p.value(n.Val())
case ONAME: 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, // 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. // 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. // These nodes have the special property that they are names with a left OTYPE and a right ONAME.
......
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