Chromium Code Reviews| 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,6 +2082,8 @@ |
| SequenceNode* Parser::ParseFunc(const Function& func, |
| Array& default_parameter_values) { |
| TRACE_PARSER("ParseFunc"); |
| + innermost_function_ = func.raw(); |
|
regis
2012/06/22 23:58:32
You should assert that func.parent() == innermost_
hausner
2012/06/23 00:15:04
Good catch!
Actually, I initialize innermost_func
|
| + |
| if (func.IsConstructor()) { |
| return ParseConstructor(func, default_parameter_values); |
| } |
| @@ -4197,10 +4206,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 +5395,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. |