Index: runtime/vm/kernel_to_il.cc |
diff --git a/runtime/vm/kernel_to_il.cc b/runtime/vm/kernel_to_il.cc |
index 2f1b8f2a7ce029b43c95a813ed8ec33b61f86d47..53985e21e2cd58b4209ff344cc4c4403c4a97208 100644 |
--- a/runtime/vm/kernel_to_il.cc |
+++ b/runtime/vm/kernel_to_il.cc |
@@ -662,7 +662,7 @@ void ScopeBuilder::VisitFunctionNode(FunctionNode* node) { |
node->body()->AcceptStatementVisitor(this); |
} |
- // Ensure that :await_jump_var and :await_ctx_var are captured. |
+ // Ensure that :await_jump_var, :await_ctx_var and :async_op are captured. |
if (node->async_marker() == FunctionNode::kSyncYielding) { |
{ |
LocalVariable* temp = NULL; |
@@ -676,6 +676,13 @@ void ScopeBuilder::VisitFunctionNode(FunctionNode* node) { |
(depth_.function_ == 0) ? &result_->yield_context_variable : &temp, |
Symbols::AwaitContextVar()); |
} |
+ { |
+ LocalVariable* temp = |
+ scope_->LookupVariable(Symbols::AsyncOperation(), true); |
+ if (temp != NULL) { |
+ scope_->CaptureVariable(temp); |
+ } |
+ } |
} |
} |