Index: runtime/vm/parser.cc |
=================================================================== |
--- runtime/vm/parser.cc (revision 41279) |
+++ runtime/vm/parser.cc (working copy) |
@@ -127,6 +127,19 @@ |
} |
+LocalVariable* ParsedFunction::EnsureSavedCurrentContext() { |
+ if (!has_saved_current_context_var()) { |
+ LocalVariable* temp = new(I) LocalVariable( |
+ function().token_pos(), |
+ Symbols::SavedCurrentContextVar(), |
+ Type::ZoneHandle(I, Type::DynamicType())); |
+ ASSERT(temp != NULL); |
+ set_saved_current_context_var(temp); |
+ } |
+ return saved_current_context_var(); |
+} |
+ |
+ |
void ParsedFunction::EnsureFinallyReturnTemp() { |
if (!has_finally_return_temp_var()) { |
LocalVariable* temp = new(I) LocalVariable( |
@@ -345,6 +358,7 @@ |
if (FLAG_enable_type_checks) { |
EnsureExpressionTemp(); |
} |
+ EnsureSavedCurrentContext(); |
} |
@@ -1387,7 +1401,6 @@ |
ASSERT(!owner.IsNull()); |
AstNode* result = NULL; |
if (owner.IsSignatureClass() && name.Equals(Symbols::Call())) { |
- EnsureSavedCurrentContext(); |
result = new ClosureCallNode(token_pos, getter_call, args); |
} else { |
result = BuildClosureCall(token_pos, getter_call, args); |
@@ -8549,15 +8562,7 @@ |
void Parser::EnsureSavedCurrentContext() { |
- // Used later by the flow_graph_builder to save current context. |
- if (!parsed_function()->has_saved_current_context_var()) { |
- LocalVariable* temp = new(I) LocalVariable( |
- current_function().token_pos(), |
- Symbols::SavedCurrentContextVar(), |
- Type::ZoneHandle(I, Type::DynamicType())); |
- ASSERT(temp != NULL); |
- parsed_function()->set_saved_current_context_var(temp); |
- } |
+ parsed_function()->EnsureSavedCurrentContext(); |
} |