• Matthew Dempsky's avatar
    cmd/compile: refactor generic AST walking code · 12c9d753
    Matthew Dempsky authored
    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: default avatarRobert Griesemer <gri@golang.org>
    12c9d753
racewalk.go 13.2 KB