aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/pkginit
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2020-12-26 22:00:53 -0800
committerMatthew Dempsky <mdempsky@google.com>2020-12-28 07:45:00 +0000
commitfbc4458c068459940c63952bcc6a697728f508fc (patch)
tree93eb968a3ecd71476325f3064d9f43d0a37f1b1e /src/cmd/compile/internal/pkginit
parent6c676775419b4cfc9f1a3b8959d538b81cec754e (diff)
downloadgo-fbc4458c068459940c63952bcc6a697728f508fc.tar.gz
go-fbc4458c068459940c63952bcc6a697728f508fc.zip
[dev.regabi] cmd/compile: simplify some tree traversal code
When looking for referenced functions within bottomUpVisitor and initDeps, the logic for ODOTMETH, OCALLPART, and OMETHEXPR are basically identical, especially after previous refactorings to make them use MethodExprName. This CL makes them exactly identical. Passes toolstash -cmp. Change-Id: I1f59c9be99aa9484d0397a0a6fb8ddd894a31c68 Reviewed-on: https://go-review.googlesource.com/c/go/+/280441 Trust: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Diffstat (limited to 'src/cmd/compile/internal/pkginit')
-rw-r--r--src/cmd/compile/internal/pkginit/initorder.go6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/cmd/compile/internal/pkginit/initorder.go b/src/cmd/compile/internal/pkginit/initorder.go
index d63c5a4717..c6e223954d 100644
--- a/src/cmd/compile/internal/pkginit/initorder.go
+++ b/src/cmd/compile/internal/pkginit/initorder.go
@@ -289,10 +289,6 @@ func (d *initDeps) inspectList(l ir.Nodes) { ir.VisitList(l, d.cachedVisit()) }
// referenced by n, if any.
func (d *initDeps) visit(n ir.Node) {
switch n.Op() {
- case ir.OMETHEXPR:
- n := n.(*ir.MethodExpr)
- d.foundDep(ir.MethodExprName(n))
-
case ir.ONAME:
n := n.(*ir.Name)
switch n.Class_ {
@@ -304,7 +300,7 @@ func (d *initDeps) visit(n ir.Node) {
n := n.(*ir.ClosureExpr)
d.inspectList(n.Func.Body)
- case ir.ODOTMETH, ir.OCALLPART:
+ case ir.ODOTMETH, ir.OCALLPART, ir.OMETHEXPR:
d.foundDep(ir.MethodExprName(n))
}
}