mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: refactor method expression detection
Eliminates lots of ad hoc code for recognizing the same thing in different ways. Passes toolstash-check. Change-Id: Ic0bb005308e96331b4ef30f455b860e476725b61 Reviewed-on: https://go-review.googlesource.com/73190 Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
6a223b82a4
commit
fcd32885df
6 changed files with 13 additions and 12 deletions
|
|
@ -209,6 +209,11 @@ func (n *Node) mayBeShared() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
// isMethodExpression reports whether n represents a method expression T.M.
|
||||
func (n *Node) isMethodExpression() bool {
|
||||
return n.Op == ONAME && n.Left != nil && n.Left.Op == OTYPE && n.Right != nil && n.Right.Op == ONAME
|
||||
}
|
||||
|
||||
// funcname returns the name of the function n.
|
||||
func (n *Node) funcname() string {
|
||||
if n == nil || n.Func == nil || n.Func.Nname == nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue