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 ebb8574fa66247fe85ac0eee98cb26ca0e74fa14..3cc0f217f39f822458b51a6b02d15def640bb410 100644 |
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart |
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart |
@@ -128,6 +128,17 @@ class Reference<T extends Definition<T>> { |
} |
if (next != null) next.previous = previous; |
} |
+ |
+ /// Changes the definition referenced by this object and updates |
+ /// the reference chains accordingly. |
+ void changeTo(Definition<T> newDefinition) { |
+ unlink(); |
+ previous = null; |
+ definition = newDefinition; |
+ next = definition.firstRef; |
+ if (next != null) next.previous = this; |
+ definition.firstRef = this; |
+ } |
} |
/// Evaluates a primitive and binds it to variable: `let val x = V in E`. |