cmd/compile: add Node.IsMethod helper

Changes generated with eg:

func before(n *gc.Node) bool { return n.Type.Recv() != nil }
func after(n *gc.Node) bool  { return n.IsMethod() }

func before(n *gc.Node) bool { return n.Type.Recv() == nil }
func after(n *gc.Node) bool  { return !n.IsMethod() }

Change-Id: I28e544490d17bbdc06ab11ed32464af5802ab206
Reviewed-on: https://go-review.googlesource.com/28968
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Josh Bleecher Snyder 2016-09-11 14:43:37 -07:00
parent 3bf141955b
commit 2e4dc86bfb
5 changed files with 12 additions and 6 deletions

View file

@ -144,7 +144,7 @@ func emitptrargsmap() {
off := duint32(sym, 0, uint32(nbitmap))
off = duint32(sym, off, uint32(bv.n))
var xoffset int64
if Curfn.Type.Recv() != nil {
if Curfn.IsMethod() {
xoffset = 0
onebitwalktype1(Curfn.Type.Recvs(), &xoffset, bv)
}