Skip to content

Commit 85a20c8

Browse files
committed
Rename WalkDown() to WalkBlock().
1 parent b279e59 commit 85a20c8

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

config/staticconfig/internal/ssax/flow.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,23 @@ import (
88

99
// WalkFunc recursively yields all reachable blocks in the given function.
1010
func WalkFunc(fn *ssa.Function) iter.Seq[*ssa.BasicBlock] {
11-
if len(fn.Blocks) == 0 {
12-
return func(func(*ssa.BasicBlock) bool) {}
11+
return func(yield func(*ssa.BasicBlock) bool) {
12+
if len(fn.Blocks) != 0 {
13+
for b := range WalkBlock(fn.Blocks[0]) {
14+
if !yield(b) {
15+
return
16+
}
17+
}
18+
}
1319
}
14-
return WalkDown(fn.Blocks[0])
1520
}
1621

17-
// WalkDown recursively yields b and all reachable successor blocks of b.
22+
// WalkBlock recursively yields b and all reachable successor blocks of b.
1823
//
1924
// A block is considered reachable if there is a control flow path from b to
2025
// that block that does not depend on a condition that is known to be false at
2126
// compile-time.
22-
func WalkDown(b *ssa.BasicBlock) iter.Seq[*ssa.BasicBlock] {
27+
func WalkBlock(b *ssa.BasicBlock) iter.Seq[*ssa.BasicBlock] {
2328
return walk(b, DirectSuccessors)
2429
}
2530

@@ -59,7 +64,7 @@ func PathExists(from, to *ssa.BasicBlock) bool {
5964
panic("blocks are not in the same function")
6065
}
6166

62-
for b := range WalkDown(from) {
67+
for b := range WalkBlock(from) {
6368
if b == to {
6469
return true
6570
}

config/staticconfig/internal/ssax/value.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func staticValuesFromCall(
8888
outputs := make([]optional.Optional[ssa.Value], n)
8989
conflicting := make([]bool, n)
9090

91-
for b := range WalkDown(fn.Blocks[0]) {
91+
for b := range WalkBlock(fn.Blocks[0]) {
9292
ret, ok := Terminator[*ssa.Return](b).TryGet()
9393
if !ok {
9494
continue

config/staticconfig/varargs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func resolveVariadic(
6161
return
6262
}
6363

64-
for b := range ssax.WalkDown(array.Block()) {
64+
for b := range ssax.WalkBlock(array.Block()) {
6565
if !ssax.PathExists(b, inst.Block()) {
6666
continue
6767
}

0 commit comments

Comments
 (0)