]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: refactor generic AST walking code
authorMatthew Dempsky <mdempsky@google.com>
Thu, 19 Oct 2017 18:23:12 +0000 (11:23 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Thu, 19 Oct 2017 20:06:45 +0000 (20:06 +0000)
commit12c9d753f83ab4755151c8a72c212358dd85bc83
treeef4438a45473d2f8133f26d89f7299a488635d13
parent5313d3f23694fdc051ed095960345df01670107e
cmd/compile: refactor generic AST walking code

racewalk's "foreach" function applies a function to all of a Node's
immediate children, but with a non-idiomatic signature.

This CL reworks it to recursively iterate over the entire subtree
rooted at Node and provides a way to short-circuit iteration.

Passes toolstash -cmp for std cmd with -race.

Change-Id: I738b73953d608709802c97945b7e0f4e4940d3f4
Reviewed-on: https://go-review.googlesource.com/71911
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/compile/internal/gc/racewalk.go
src/cmd/compile/internal/gc/syntax.go