Skip to content

Commit

Permalink
Better performance of bottomupNoBridges by avoiding the triggering of…
Browse files Browse the repository at this point in the history
  • Loading branch information
datYori authored Sep 12, 2024
1 parent 3c3e472 commit 18c24f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class Tree[T <: AnyRef with Product, +R <: T](val originalRoot : R, shape : Tree
* A version of `bottomup` that doesn't traverse bridges.
*/
def bottomupNoBridges(s : Strategy) : Strategy =
rule[Bridge[_]] { case b => b } <+
rule[Any] { case b : Bridge[_] => b } <+
(all(bottomupNoBridges(s)) <* s)

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ trait Cloner {
def deepclone[T <: Product](t : T) : T = {

val deepcloner =
everywherebu(rule[T] {
case n if isLeaf(n) =>
everywherebu(rule[Any] {
case n : Product if isLeaf(n) =>
copy(n)
})

Expand All @@ -55,8 +55,8 @@ trait Cloner {
val seen = makeIdMemoiser[Product, Boolean]()

val lazycloner =
bu(rule[T] {
case n if isLeaf(n) =>
bu(rule[Any] {
case n : Product if isLeaf(n) =>
if (seen.getOrDefault(n, false))
copy(n)
else {
Expand Down

0 comments on commit 18c24f1

Please sign in to comment.