Index: pkg/compiler/lib/src/cps_ir/cps_fragment.dart |
diff --git a/pkg/compiler/lib/src/cps_ir/cps_fragment.dart b/pkg/compiler/lib/src/cps_ir/cps_fragment.dart |
index 4a1f34056156fdb184f01b250f4e70d3856e78cf..79ad510e3957e6608e47f1ffdbdafbf50c607a97 100644 |
--- a/pkg/compiler/lib/src/cps_ir/cps_fragment.dart |
+++ b/pkg/compiler/lib/src/cps_ir/cps_fragment.dart |
@@ -10,6 +10,7 @@ import '../universe/selector.dart' show Selector; |
import '../types/types.dart' show TypeMask; |
import '../io/source_information.dart'; |
import '../elements/elements.dart'; |
+import 'parent_visitor.dart'; |
/// Builds a CPS fragment that can be plugged into another CPS term. |
/// |
@@ -83,6 +84,7 @@ class CpsFragment { |
} |
if (context != null) { |
context.body = node; |
+ node.parent = context; |
} |
context = null; |
} |
@@ -297,4 +299,19 @@ class CpsFragment { |
put(let); |
context = let; |
} |
+ |
+ void insertBelow(InteriorNode node) { |
+ assert(isOpen); |
+ if (isEmpty) return; |
+ Expression child = node.body; |
+ node.body = root; |
+ root.parent = node; |
+ context.body = child; |
+ child.parent = context; |
+ root = context = null; |
+ } |
+ |
+ void insertAbove(InteriorExpression node) { |
+ insertBelow(node.parent); |
+ } |
} |