Index: runtime/vm/kernel_to_il.cc |
diff --git a/runtime/vm/kernel_to_il.cc b/runtime/vm/kernel_to_il.cc |
index 21b5ce83223ed25cef1657803ba3a8a7ff21a27c..69a12bb21c1c3b234b0ce0ed0d92df62637c4704 100644 |
--- a/runtime/vm/kernel_to_il.cc |
+++ b/runtime/vm/kernel_to_il.cc |
@@ -101,6 +101,9 @@ void ScopeBuilder::AddParameter(VariableDeclaration* declaration, |
if (declaration->IsFinal()) { |
variable->set_is_final(); |
} |
+ if (variable->name().raw() == Symbols::IteratorParameter().raw()) { |
+ variable->set_is_forced_stack(); |
+ } |
scope_->InsertParameterAt(pos, variable); |
result_->locals.Insert(declaration->kernel_offset(), variable); |
@@ -303,7 +306,6 @@ ScopeBuildingResult* ScopeBuilder::BuildScopes() { |
LocalVariable* context_var = parsed_function->current_context_var(); |
context_var->set_is_forced_stack(); |
scope_->AddVariable(context_var); |
- scope_->AddVariable(parsed_function->EnsureExpressionTemp()); |
parsed_function->SetNodeSequence( |
new SequenceNode(TokenPosition::kNoSource, scope_)); |
@@ -443,7 +445,9 @@ ScopeBuildingResult* ScopeBuilder::BuildScopes() { |
case RawFunction::kIrregexpFunction: |
UNREACHABLE(); |
} |
- |
+ if (needs_expr_temp_) { |
+ scope_->AddVariable(parsed_function_->EnsureExpressionTemp()); |
+ } |
parsed_function->AllocateVariables(); |
return result_; |
@@ -485,6 +489,18 @@ void ScopeBuilder::VisitVariableSet(VariableSet* node) { |
} |
+void ScopeBuilder::VisitConditionalExpression(ConditionalExpression* node) { |
+ needs_expr_temp_ = true; |
+ node->VisitChildren(this); |
+} |
+ |
+ |
+void ScopeBuilder::VisitLogicalExpression(LogicalExpression* node) { |
+ needs_expr_temp_ = true; |
+ node->VisitChildren(this); |
+} |
+ |
+ |
void ScopeBuilder::HandleLocalFunction(TreeNode* parent, |
FunctionNode* function) { |
LocalScope* saved_function_scope = current_function_scope_; |