mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.regabi] cmd/compile: rename ir.Find to ir.Any and update uses
ir.Find is called "any" in C#, Dart, Haskell, Python, R, Ruby, and Rust, and "any_of" in C++, "anyMatch" in Java, "some" in JavaScript, "exists in OCaml, and "existsb" in Coq. (Thanks to Matthew Dempsky for the research.) This CL changes Find to Any to use the mostly standard name. It also updates wrapper helpers to use the any terminology: hasCall -> anyCall hasCallOrChan -> anyCallOrChan hasSideEffects -> anySideEffects Unchanged are "hasNamedResults", "hasUniquePos", and "hasDefaultCase", which are all about a single node, not any node in the IR tree. I also renamed hasFall to endsInFallthrough, since its semantics are neither that of "any" nor that of the remaining "has" functions. So the new terminology helps separate different kinds of predicates nicely. Change-Id: I9bb3c9ebf060a30447224be09a5c34ad5244ea0d Reviewed-on: https://go-review.googlesource.com/c/go/+/278912 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
aeedc9f804
commit
0b9cb63b8d
7 changed files with 37 additions and 37 deletions
|
|
@ -60,7 +60,7 @@ func (s *InitSchedule) tryStaticInit(n ir.Node) bool {
|
|||
if n.Op() != ir.OAS {
|
||||
return false
|
||||
}
|
||||
if ir.IsBlank(n.Left()) && !hasSideEffects(n.Right()) {
|
||||
if ir.IsBlank(n.Left()) && !anySideEffects(n.Right()) {
|
||||
// Discard.
|
||||
return true
|
||||
}
|
||||
|
|
@ -546,7 +546,7 @@ func fixedlit(ctxt initContext, kind initKind, n ir.Node, var_ ir.Node, init *ir
|
|||
|
||||
for _, r := range n.List().Slice() {
|
||||
a, value := splitnode(r)
|
||||
if a == ir.BlankNode && !hasSideEffects(value) {
|
||||
if a == ir.BlankNode && !anySideEffects(value) {
|
||||
// Discard.
|
||||
continue
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue