aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/syntax
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2023-01-05 15:07:04 -0800
committerGopher Robot <gobot@golang.org>2023-01-17 19:55:04 +0000
commit3c357409d1e9797bec88a5a1dafae13ba2c45a18 (patch)
tree7e2cfc6002bcbfbb4020cfc918f6b56f4d6f3ecf /src/cmd/compile/internal/syntax
parentd4639ecdfc9051a7adcfb8945d93a45da56576ae (diff)
downloadgo-3c357409d1e9797bec88a5a1dafae13ba2c45a18.tar.xz
cmd/compile/internal/syntax: remove Crawl, not needed anymore (cleanup)
This also brings some of the types2 testing code better in sync with go/types. Also: fix a minor bug in resolver_test.go (continue traversing SelectorExpr if the first part is not an identifier). Change-Id: Ib6c5f6228812b49c185b52a4f02ca5b393418e01 Reviewed-on: https://go-review.googlesource.com/c/go/+/460760 Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com> Run-TryBot: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/syntax')
-rw-r--r--src/cmd/compile/internal/syntax/walk.go22
1 files changed, 3 insertions, 19 deletions
diff --git a/src/cmd/compile/internal/syntax/walk.go b/src/cmd/compile/internal/syntax/walk.go
index 8f1d566155..b03a7c14b0 100644
--- a/src/cmd/compile/internal/syntax/walk.go
+++ b/src/cmd/compile/internal/syntax/walk.go
@@ -8,10 +8,9 @@ package syntax
import "fmt"
-// Inspect traverses an AST in pre-order: It starts by calling
-// f(node); node must not be nil. If f returns true, Inspect invokes f
-// recursively for each of the non-nil children of node, followed by a
-// call of f(nil).
+// Inspect traverses an AST in pre-order: it starts by calling f(root);
+// root must not be nil. If f returns true, Inspect invokes f recursively
+// for each of the non-nil children of root, followed by a call of f(nil).
//
// See Walk for caveats about shared nodes.
func Inspect(root Node, f func(Node) bool) {
@@ -27,21 +26,6 @@ func (v inspector) Visit(node Node) Visitor {
return nil
}
-// Crawl traverses a syntax in pre-order: It starts by calling f(root);
-// root must not be nil. If f returns false (== "continue"), Crawl calls
-// f recursively for each of the non-nil children of that node; if f
-// returns true (== "stop"), Crawl does not traverse the respective node's
-// children.
-//
-// See Walk for caveats about shared nodes.
-//
-// Deprecated: Use Inspect instead.
-func Crawl(root Node, f func(Node) bool) {
- Inspect(root, func(node Node) bool {
- return node != nil && !f(node)
- })
-}
-
// Walk traverses an AST in pre-order: It starts by calling
// v.Visit(node); node must not be nil. If the visitor w returned by
// v.Visit(node) is not nil, Walk is invoked recursively with visitor