mirror of
https://github.com/golang/go
synced 2024-11-20 10:54:49 -07:00
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: Alan Donovan <adonovan@google.com>
This commit is contained in:
parent
3098cf0175
commit
c64e793850
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user