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