Index: pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart |
diff --git a/pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart b/pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart |
index 422db14ac1ace1f90c0a3d38c4695e691e328a81..f7365b44e731ae5b3ff18cb30d9681d887f5e78d 100644 |
--- a/pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart |
+++ b/pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart |
@@ -166,6 +166,17 @@ class ShrinkingReducer extends Pass { |
InvokeContinuation invoke = cont.body; |
Continuation wrappedCont = invoke.continuation.definition; |
+ // If the invocation of wrappedCont is escaping, then all invocations of |
+ // cont will be as well, after the reduction. |
+ if (invoke.isEscapingTry) { |
+ Reference current = cont.firstRef; |
+ while (current != null) { |
+ InvokeContinuation owner = current.parent; |
+ owner.isEscapingTry = true; |
+ current = current.next; |
+ } |
+ } |
+ |
// Replace all occurrences with the wrapped continuation. |
cont.replaceUsesWith(wrappedCont); |