Index: pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart |
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart |
index a7f0c9f7017a5d7a41e1d1ecb7b8e45c2fa4eb7a..1b6c6a1aa142254dfd585d3579bfd8fcf33c528f 100644 |
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart |
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart |
@@ -37,11 +37,12 @@ abstract class Definition<T extends Definition<T>> extends Node { |
bool get hasAtMostOneUse => firstRef == null || firstRef.next == null; |
bool get hasExactlyOneUse => firstRef != null && firstRef.next == null; |
+ bool get hasNoUses => firstRef == null; |
bool get hasAtLeastOneUse => firstRef != null; |
bool get hasMultipleUses => !hasAtMostOneUse; |
void substituteFor(Definition<T> other) { |
- if (other.firstRef == null) return; |
+ if (other.hasNoUses) return; |
Reference<T> previous, current = other.firstRef; |
do { |
current.definition = this; |
@@ -51,6 +52,7 @@ abstract class Definition<T extends Definition<T>> extends Node { |
previous.next = firstRef; |
if (firstRef != null) firstRef.previous = previous; |
firstRef = other.firstRef; |
+ other.firstRef = null; |
} |
} |