| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_PARSER_H_ | 5 #ifndef VM_PARSER_H_ |
| 6 #define VM_PARSER_H_ | 6 #define VM_PARSER_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 | 9 |
| 10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 LocalVariable* instantiator() const { return instantiator_; } | 82 LocalVariable* instantiator() const { return instantiator_; } |
| 83 void set_instantiator(LocalVariable* instantiator) { | 83 void set_instantiator(LocalVariable* instantiator) { |
| 84 // May be NULL. | 84 // May be NULL. |
| 85 instantiator_ = instantiator; | 85 instantiator_ = instantiator; |
| 86 } | 86 } |
| 87 | 87 |
| 88 void set_default_parameter_values(ZoneGrowableArray<const Instance*>* list) { | 88 void set_default_parameter_values(ZoneGrowableArray<const Instance*>* list) { |
| 89 default_parameter_values_ = list; | 89 default_parameter_values_ = list; |
| 90 #if defined(DEBUG) | 90 #if defined(DEBUG) |
| 91 if (list == NULL) return; |
| 91 for (intptr_t i = 0; i < list->length(); i++) { | 92 for (intptr_t i = 0; i < list->length(); i++) { |
| 92 ASSERT(list->At(i)->IsZoneHandle() || list->At(i)->InVMHeap()); | 93 ASSERT(list->At(i)->IsZoneHandle() || list->At(i)->InVMHeap()); |
| 93 } | 94 } |
| 94 #endif | 95 #endif |
| 95 } | 96 } |
| 96 | 97 |
| 97 | 98 |
| 98 const Instance& DefaultParameterValueAt(intptr_t i) const { | 99 const Instance& DefaultParameterValueAt(intptr_t i) const { |
| 99 ASSERT(default_parameter_values_ != NULL); | 100 ASSERT(default_parameter_values_ != NULL); |
| 100 return *default_parameter_values_->At(i); | 101 return *default_parameter_values_->At(i); |
| 101 } | 102 } |
| 102 | 103 |
| 104 ZoneGrowableArray<const Instance*>* default_parameter_values() const { |
| 105 return default_parameter_values_; |
| 106 } |
| 107 |
| 103 LocalVariable* current_context_var() const { | 108 LocalVariable* current_context_var() const { |
| 104 return current_context_var_; | 109 return current_context_var_; |
| 105 } | 110 } |
| 106 | 111 |
| 107 LocalVariable* expression_temp_var() const { | 112 LocalVariable* expression_temp_var() const { |
| 108 ASSERT(has_expression_temp_var()); | 113 ASSERT(has_expression_temp_var()); |
| 109 return expression_temp_var_; | 114 return expression_temp_var_; |
| 110 } | 115 } |
| 111 void set_expression_temp_var(LocalVariable* value) { | 116 void set_expression_temp_var(LocalVariable* value) { |
| 112 ASSERT(!has_expression_temp_var()); | 117 ASSERT(!has_expression_temp_var()); |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 ArgumentListNode* arguments, | 516 ArgumentListNode* arguments, |
| 512 bool resolve_getter, | 517 bool resolve_getter, |
| 513 bool* is_no_such_method); | 518 bool* is_no_such_method); |
| 514 AstNode* ParseSuperCall(const String& function_name); | 519 AstNode* ParseSuperCall(const String& function_name); |
| 515 AstNode* ParseSuperFieldAccess(const String& field_name, intptr_t field_pos); | 520 AstNode* ParseSuperFieldAccess(const String& field_name, intptr_t field_pos); |
| 516 AstNode* ParseSuperOperator(); | 521 AstNode* ParseSuperOperator(); |
| 517 AstNode* BuildUnarySuperOperator(Token::Kind op, PrimaryNode* super); | 522 AstNode* BuildUnarySuperOperator(Token::Kind op, PrimaryNode* super); |
| 518 | 523 |
| 519 static bool ParseFormalParameters(const Function& func, ParamList* params); | 524 static bool ParseFormalParameters(const Function& func, ParamList* params); |
| 520 | 525 |
| 521 static void SetupDefaultsForOptionalParams( | 526 void SetupDefaultsForOptionalParams(const ParamList& params); |
| 522 const ParamList& params, | |
| 523 ZoneGrowableArray<const Instance*>* default_values); | |
| 524 ClosureNode* CreateImplicitClosureNode(const Function& func, | 527 ClosureNode* CreateImplicitClosureNode(const Function& func, |
| 525 intptr_t token_pos, | 528 intptr_t token_pos, |
| 526 AstNode* receiver); | 529 AstNode* receiver); |
| 527 static void AddFormalParamsToFunction(const ParamList* params, | 530 static void AddFormalParamsToFunction(const ParamList* params, |
| 528 const Function& func); | 531 const Function& func); |
| 529 void AddFormalParamsToScope(const ParamList* params, LocalScope* scope); | 532 void AddFormalParamsToScope(const ParamList* params, LocalScope* scope); |
| 530 | 533 |
| 531 SequenceNode* ParseConstructor( | 534 SequenceNode* ParseConstructor(const Function& func); |
| 532 const Function& func, ZoneGrowableArray<const Instance*>* default_values); | 535 SequenceNode* ParseFunc(const Function& func); |
| 533 SequenceNode* ParseFunc( | |
| 534 const Function& func, ZoneGrowableArray<const Instance*>* default_values); | |
| 535 | 536 |
| 536 void ParseNativeFunctionBlock(const ParamList* params, const Function& func); | 537 void ParseNativeFunctionBlock(const ParamList* params, const Function& func); |
| 537 | 538 |
| 538 SequenceNode* ParseInstanceGetter(const Function& func); | 539 SequenceNode* ParseInstanceGetter(const Function& func); |
| 539 SequenceNode* ParseInstanceSetter(const Function& func); | 540 SequenceNode* ParseInstanceSetter(const Function& func); |
| 540 SequenceNode* ParseStaticFinalGetter(const Function& func); | 541 SequenceNode* ParseStaticFinalGetter(const Function& func); |
| 541 SequenceNode* ParseStaticInitializer(); | 542 SequenceNode* ParseStaticInitializer(); |
| 542 SequenceNode* ParseMethodExtractor(const Function& func); | 543 SequenceNode* ParseMethodExtractor(const Function& func); |
| 543 SequenceNode* ParseNoSuchMethodDispatcher( | 544 SequenceNode* ParseNoSuchMethodDispatcher(const Function& func); |
| 544 const Function& func, ZoneGrowableArray<const Instance*>* default_values); | 545 SequenceNode* ParseInvokeFieldDispatcher(const Function& func); |
| 545 SequenceNode* ParseInvokeFieldDispatcher( | 546 SequenceNode* ParseImplicitClosure(const Function& func); |
| 546 const Function& func, ZoneGrowableArray<const Instance*>* default_values); | 547 SequenceNode* ParseConstructorClosure(const Function& func); |
| 547 SequenceNode* ParseImplicitClosure( | |
| 548 const Function& func, ZoneGrowableArray<const Instance*>* default_values); | |
| 549 SequenceNode* ParseConstructorClosure( | |
| 550 const Function& func, ZoneGrowableArray<const Instance*>* default_values); | |
| 551 | 548 |
| 552 void BuildDispatcherScope(const Function& func, | 549 void BuildDispatcherScope(const Function& func, |
| 553 const ArgumentsDescriptor& desc, | 550 const ArgumentsDescriptor& desc); |
| 554 ZoneGrowableArray<const Instance*>* default_values); | |
| 555 | 551 |
| 556 void EnsureHasReturnStatement(SequenceNode* seq, intptr_t return_pos); | 552 void EnsureHasReturnStatement(SequenceNode* seq, intptr_t return_pos); |
| 557 void ChainNewBlock(LocalScope* outer_scope); | 553 void ChainNewBlock(LocalScope* outer_scope); |
| 558 void OpenBlock(); | 554 void OpenBlock(); |
| 559 void OpenLoopBlock(); | 555 void OpenLoopBlock(); |
| 560 void OpenFunctionBlock(const Function& func); | 556 void OpenFunctionBlock(const Function& func); |
| 561 void OpenAsyncClosure(); | 557 void OpenAsyncClosure(); |
| 562 RawFunction* OpenAsyncFunction(intptr_t formal_param_pos); | 558 RawFunction* OpenAsyncFunction(intptr_t formal_param_pos); |
| 563 RawFunction* OpenSyncGeneratorFunction(intptr_t func_pos); | 559 RawFunction* OpenSyncGeneratorFunction(intptr_t func_pos); |
| 564 SequenceNode* CloseSyncGenFunction(const Function& closure, | 560 SequenceNode* CloseSyncGenFunction(const Function& closure, |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 | 886 |
| 891 // Indentation of parser trace. | 887 // Indentation of parser trace. |
| 892 intptr_t trace_indent_; | 888 intptr_t trace_indent_; |
| 893 | 889 |
| 894 DISALLOW_COPY_AND_ASSIGN(Parser); | 890 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 895 }; | 891 }; |
| 896 | 892 |
| 897 } // namespace dart | 893 } // namespace dart |
| 898 | 894 |
| 899 #endif // VM_PARSER_H_ | 895 #endif // VM_PARSER_H_ |
| OLD | NEW |