| 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 "lib/invocation_mirror.h" | 10 #include "lib/invocation_mirror.h" |
| 11 #include "platform/assert.h" | 11 #include "vm/ast.h" |
| 12 #include "platform/globals.h" | |
| 13 #include "vm/allocation.h" | |
| 14 #include "vm/class_finalizer.h" | 12 #include "vm/class_finalizer.h" |
| 15 #include "vm/compiler_stats.h" | 13 #include "vm/compiler_stats.h" |
| 16 #include "vm/object.h" | 14 #include "vm/scanner.h" |
| 17 #include "vm/raw_object.h" | |
| 18 #include "vm/token.h" | |
| 19 | 15 |
| 20 namespace dart { | 16 namespace dart { |
| 21 | 17 |
| 22 // Forward declarations. | 18 // Forward declarations. |
| 23 class ArgumentListNode; | |
| 24 class ArgumentsDescriptor; | 19 class ArgumentsDescriptor; |
| 25 class AstNode; | 20 class Function; |
| 26 class CaseNode; | 21 class Isolate; |
| 22 class LiteralToken; |
| 23 class Script; |
| 24 class TokenStream; |
| 25 |
| 26 struct TopLevel; |
| 27 class ClassDesc; | 27 class ClassDesc; |
| 28 class ConstructorCallNode; | |
| 29 template <typename T> class GrowableArray; | |
| 30 class InlinedFinallyNode; | |
| 31 class Isolate; | |
| 32 class LetNode; | |
| 33 class LiteralNode; | |
| 34 class LocalScope; | |
| 35 class LocalVariable; | |
| 36 class PrimaryNode; | |
| 37 class SequenceNode; | |
| 38 class SourceLabel; | |
| 39 class StaticCallNode; | |
| 40 | |
| 41 struct CatchParameter; | |
| 42 struct MemberDesc; | 28 struct MemberDesc; |
| 43 struct ParamList; | 29 struct ParamList; |
| 44 struct QualIdent; | 30 struct QualIdent; |
| 45 struct TopLevel; | 31 struct CatchParamDesc; |
| 32 struct FieldInitExpression; |
| 46 | 33 |
| 47 // The class ParsedFunction holds the result of parsing a function. | 34 // The class ParsedFunction holds the result of parsing a function. |
| 48 class ParsedFunction : public ZoneAllocated { | 35 class ParsedFunction : public ZoneAllocated { |
| 49 public: | 36 public: |
| 50 explicit ParsedFunction(const Function& function) | 37 explicit ParsedFunction(const Function& function) |
| 51 : function_(function), | 38 : function_(function), |
| 52 node_sequence_(NULL), | 39 node_sequence_(NULL), |
| 53 instantiator_(NULL), | 40 instantiator_(NULL), |
| 54 default_parameter_values_(Array::ZoneHandle()), | 41 default_parameter_values_(Array::ZoneHandle()), |
| 55 saved_current_context_var_(NULL), | 42 saved_current_context_var_(NULL), |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 AstNode* ParseDoWhileStatement(String* label_name); | 498 AstNode* ParseDoWhileStatement(String* label_name); |
| 512 AstNode* ParseForStatement(String* label_name); | 499 AstNode* ParseForStatement(String* label_name); |
| 513 AstNode* ParseForInStatement(intptr_t forin_pos, SourceLabel* label); | 500 AstNode* ParseForInStatement(intptr_t forin_pos, SourceLabel* label); |
| 514 RawClass* CheckCaseExpressions(const GrowableArray<LiteralNode*>& values); | 501 RawClass* CheckCaseExpressions(const GrowableArray<LiteralNode*>& values); |
| 515 CaseNode* ParseCaseClause(LocalVariable* switch_expr_value, | 502 CaseNode* ParseCaseClause(LocalVariable* switch_expr_value, |
| 516 GrowableArray<LiteralNode*>* case_expr_values, | 503 GrowableArray<LiteralNode*>* case_expr_values, |
| 517 SourceLabel* case_label); | 504 SourceLabel* case_label); |
| 518 AstNode* ParseSwitchStatement(String* label_name); | 505 AstNode* ParseSwitchStatement(String* label_name); |
| 519 | 506 |
| 520 // try/catch/finally parsing. | 507 // try/catch/finally parsing. |
| 521 void AddCatchParametersToScope(CatchParameter* exception_param, | 508 void AddCatchParamsToScope(const CatchParamDesc& exception_param, |
| 522 CatchParameter* stack_trace_param, | 509 const CatchParamDesc& stack_trace_param, |
| 523 LocalScope* scope); | 510 LocalScope* scope); |
| 524 // Parse finally block and create an AST for it. | 511 // Parse finally block and create an AST for it. |
| 525 SequenceNode* ParseFinallyBlock(); | 512 SequenceNode* ParseFinallyBlock(); |
| 526 // Adds try block to the list of try blocks seen so far. | 513 // Adds try block to the list of try blocks seen so far. |
| 527 void PushTryBlock(Block* try_block); | 514 void PushTryBlock(Block* try_block); |
| 528 // Pops the inner most try block from the list. | 515 // Pops the inner most try block from the list. |
| 529 TryBlocks* PopTryBlock(); | 516 TryBlocks* PopTryBlock(); |
| 530 // Add specified node to try block list so that it can be patched with | 517 // Add specified node to try block list so that it can be patched with |
| 531 // inlined finally code if needed. | 518 // inlined finally code if needed. |
| 532 void AddNodeForFinallyInlining(AstNode* node); | 519 void AddNodeForFinallyInlining(AstNode* node); |
| 533 // Add the inlined finally block to the specified node. | 520 // Add the inlined finally block to the specified node. |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 Token::Kind binary_op, | 623 Token::Kind binary_op, |
| 637 AstNode* lhs, | 624 AstNode* lhs, |
| 638 AstNode* rhs); | 625 AstNode* rhs); |
| 639 AstNode* ExpandAssignableOp(intptr_t op_pos, | 626 AstNode* ExpandAssignableOp(intptr_t op_pos, |
| 640 Token::Kind assignment_op, | 627 Token::Kind assignment_op, |
| 641 AstNode* lhs, | 628 AstNode* lhs, |
| 642 AstNode* rhs); | 629 AstNode* rhs); |
| 643 LetNode* PrepareCompoundAssignmentNodes(AstNode** expr); | 630 LetNode* PrepareCompoundAssignmentNodes(AstNode** expr); |
| 644 LocalVariable* CreateTempConstVariable(intptr_t token_pos, const char* s); | 631 LocalVariable* CreateTempConstVariable(intptr_t token_pos, const char* s); |
| 645 | 632 |
| 646 LocalVariable* EnsureLocalVariable(const String& name); | |
| 647 | |
| 648 static SequenceNode* NodeAsSequenceNode(intptr_t sequence_pos, | 633 static SequenceNode* NodeAsSequenceNode(intptr_t sequence_pos, |
| 649 AstNode* node, | 634 AstNode* node, |
| 650 LocalScope* scope); | 635 LocalScope* scope); |
| 651 | 636 |
| 652 SequenceNode* MakeImplicitConstructor(const Function& func); | 637 SequenceNode* MakeImplicitConstructor(const Function& func); |
| 653 AstNode* MakeStaticCall(const String& cls_name, | 638 AstNode* MakeStaticCall(const String& cls_name, |
| 654 const String& func_name, | 639 const String& func_name, |
| 655 ArgumentListNode* arguments); | 640 ArgumentListNode* arguments); |
| 656 String& Interpolate(const GrowableArray<AstNode*>& values); | 641 String& Interpolate(const GrowableArray<AstNode*>& values); |
| 657 AstNode* MakeAssertCall(intptr_t begin, intptr_t end); | 642 AstNode* MakeAssertCall(intptr_t begin, intptr_t end); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 intptr_t last_used_try_index_; | 720 intptr_t last_used_try_index_; |
| 736 | 721 |
| 737 bool unregister_pending_function_; | 722 bool unregister_pending_function_; |
| 738 | 723 |
| 739 DISALLOW_COPY_AND_ASSIGN(Parser); | 724 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 740 }; | 725 }; |
| 741 | 726 |
| 742 } // namespace dart | 727 } // namespace dart |
| 743 | 728 |
| 744 #endif // VM_PARSER_H_ | 729 #endif // VM_PARSER_H_ |
| OLD | NEW |