| Index: runtime/vm/flow_graph_builder.cc
|
| ===================================================================
|
| --- runtime/vm/flow_graph_builder.cc (revision 28280)
|
| +++ runtime/vm/flow_graph_builder.cc (working copy)
|
| @@ -2051,12 +2051,30 @@
|
| // The context scope may have already been set by the non-optimizing
|
| // compiler. If it was not, set it here.
|
| if (function.context_scope() == ContextScope::null()) {
|
| - // TODO(regis): Why are we not doing this in the parser?
|
| const ContextScope& context_scope = ContextScope::ZoneHandle(
|
| node->scope()->PreserveOuterScope(owner()->context_level()));
|
| ASSERT(!function.HasCode());
|
| ASSERT(function.context_scope() == ContextScope::null());
|
| function.set_context_scope(context_scope);
|
| + const Class& cls = Class::Handle(
|
| + owner()->parsed_function()->function().Owner());
|
| + // The closure is now properly setup, add it to the lookup table.
|
| +#if DEBUG
|
| + const Function& found_func = Function::Handle(
|
| + cls.LookupClosureFunction(function.token_pos()));
|
| + ASSERT(found_func.IsNull() ||
|
| + (found_func.token_pos() != function.token_pos()) ||
|
| + // TODO(hausner): The following check should not be necessary.
|
| + // Since we only lookup based on the token_pos we can get
|
| + // duplicate entries due to closurized and non-closurized parent
|
| + // functions (see Parser::ParseFunctionStatement).
|
| + // We need two ways to lookup in this cache: One way to cache the
|
| + // appropriate closure function and one way to find the functions
|
| + // while debugging (we might need to set breakpoints in multiple
|
| + // different function for a single token index.)
|
| + (found_func.parent_function() != function.parent_function()));
|
| +#endif // DEBUG
|
| + cls.AddClosureFunction(function);
|
| }
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments =
|
| new ZoneGrowableArray<PushArgumentInstr*>(2);
|
|
|