| Index: runtime/vm/parser.cc
|
| ===================================================================
|
| --- runtime/vm/parser.cc (revision 9036)
|
| +++ runtime/vm/parser.cc (working copy)
|
| @@ -254,6 +254,7 @@
|
| current_member_(NULL),
|
| allow_function_literals_(true),
|
| current_function_(Function::Handle()),
|
| + innermost_function_(Function::Handle()),
|
| current_class_(Class::Handle()),
|
| library_(library),
|
| try_blocks_list_(NULL),
|
| @@ -276,6 +277,7 @@
|
| current_member_(NULL),
|
| allow_function_literals_(true),
|
| current_function_(function),
|
| + innermost_function_(Function::Handle(function.raw())),
|
| current_class_(Class::Handle(current_function_.owner())),
|
| library_(Library::Handle(current_class_.library())),
|
| try_blocks_list_(NULL),
|
| @@ -301,6 +303,11 @@
|
| }
|
|
|
|
|
| +const Function& Parser::innermost_function() const {
|
| + return innermost_function_;
|
| +}
|
| +
|
| +
|
| const Class& Parser::current_class() const {
|
| return current_class_;
|
| }
|
| @@ -2075,8 +2082,14 @@
|
| SequenceNode* Parser::ParseFunc(const Function& func,
|
| Array& default_parameter_values) {
|
| TRACE_PARSER("ParseFunc");
|
| + Function& saved_innermost_function =
|
| + Function::Handle(innermost_function().raw());
|
| + innermost_function_ = func.raw();
|
| +
|
| if (func.IsConstructor()) {
|
| - return ParseConstructor(func, default_parameter_values);
|
| + SequenceNode* statements = ParseConstructor(func, default_parameter_values);
|
| + innermost_function_ = saved_innermost_function.raw();
|
| + return statements;
|
| }
|
|
|
| ASSERT(!func.IsConstructor());
|
| @@ -2151,6 +2164,7 @@
|
| }
|
| SequenceNode* body = CloseBlock();
|
| current_block_->statements->Add(body);
|
| + innermost_function_ = saved_innermost_function.raw();
|
| return CloseBlock();
|
| }
|
|
|
| @@ -4197,10 +4211,10 @@
|
| // non-closurized version of this same function.
|
| function = current_class().LookupClosureFunction(function_pos);
|
| if (function.IsNull() || (function.token_index() != function_pos) ||
|
| - (function.parent_function() != current_function().raw())) {
|
| + (function.parent_function() != innermost_function().raw())) {
|
| is_new_closure = true;
|
| function = Function::NewClosureFunction(*function_name,
|
| - current_function(),
|
| + innermost_function(),
|
| function_pos);
|
| function.set_result_type(result_type);
|
| current_class().AddClosureFunction(function);
|
| @@ -5386,7 +5400,7 @@
|
| // Finally parse the 'finally' block.
|
| SequenceNode* finally_block = NULL;
|
| if (CurrentToken() == Token::kFINALLY) {
|
| - current_function_.set_is_optimizable(false);
|
| + current_function().set_is_optimizable(false);
|
| ConsumeToken(); // Consume the 'finally'.
|
| const intptr_t finally_pos = token_index_;
|
| // Add the finally block to the exit points recorded so far.
|
|
|