From 1f78b30b75bf5bace5e1b2821fd23f0941f8d059 Mon Sep 17 00:00:00 2001 From: Alistair Michael Date: Tue, 23 Jan 2024 15:29:36 +1000 Subject: [PATCH] fix clearblocks --- src/main/scala/ir/Program.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/scala/ir/Program.scala b/src/main/scala/ir/Program.scala index e92ba2730..94a9bdd04 100644 --- a/src/main/scala/ir/Program.scala +++ b/src/main/scala/ir/Program.scala @@ -224,7 +224,7 @@ class Procedure private ( * @return an iterator to the new block set */ def replaceBlocks(newBlocks: Iterable[Block]): Unit = { - removeBlocks(_blocks) + clearBlocks() addBlocks(newBlocks) } @@ -245,7 +245,8 @@ class Procedure private ( } def clearBlocks() : Unit = { - removeBlocks(blocks) + // O(n) because we are careful to unlink the parents etc. + removeBlocks(_blocks) }