| 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" |
| 11 #include "platform/globals.h" |
| 10 #include "lib/invocation_mirror.h" | 12 #include "lib/invocation_mirror.h" |
| 13 #include "vm/allocation.h" |
| 11 #include "vm/ast.h" | 14 #include "vm/ast.h" |
| 12 #include "vm/class_finalizer.h" | 15 #include "vm/class_finalizer.h" |
| 13 #include "vm/compiler_stats.h" | 16 #include "vm/compiler_stats.h" |
| 14 #include "vm/scanner.h" | 17 #include "vm/object.h" |
| 18 #include "vm/raw_object.h" |
| 19 #include "vm/token.h" |
| 15 | 20 |
| 16 namespace dart { | 21 namespace dart { |
| 17 | 22 |
| 18 // Forward declarations. | 23 // Forward declarations. |
| 19 class ArgumentsDescriptor; | 24 class ArgumentsDescriptor; |
| 20 class Function; | |
| 21 class Isolate; | 25 class Isolate; |
| 22 class LiteralToken; | 26 class LocalScope; |
| 23 class Script; | 27 class LocalVariable; |
| 24 class TokenStream; | 28 class SourceLabel; |
| 29 template <typename T> class GrowableArray; |
| 25 | 30 |
| 26 struct TopLevel; | 31 struct CatchParamDesc; |
| 27 class ClassDesc; | 32 class ClassDesc; |
| 28 struct MemberDesc; | 33 struct MemberDesc; |
| 29 struct ParamList; | 34 struct ParamList; |
| 30 struct QualIdent; | 35 struct QualIdent; |
| 31 struct CatchParamDesc; | 36 struct TopLevel; |
| 32 struct FieldInitExpression; | |
| 33 | 37 |
| 34 // The class ParsedFunction holds the result of parsing a function. | 38 // The class ParsedFunction holds the result of parsing a function. |
| 35 class ParsedFunction : public ZoneAllocated { | 39 class ParsedFunction : public ZoneAllocated { |
| 36 public: | 40 public: |
| 37 explicit ParsedFunction(const Function& function) | 41 explicit ParsedFunction(const Function& function) |
| 38 : function_(function), | 42 : function_(function), |
| 39 node_sequence_(NULL), | 43 node_sequence_(NULL), |
| 40 instantiator_(NULL), | 44 instantiator_(NULL), |
| 41 default_parameter_values_(Array::ZoneHandle()), | 45 default_parameter_values_(Array::ZoneHandle()), |
| 42 saved_current_context_var_(NULL), | 46 saved_current_context_var_(NULL), |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 AstNode* ParseDoWhileStatement(String* label_name); | 503 AstNode* ParseDoWhileStatement(String* label_name); |
| 500 AstNode* ParseForStatement(String* label_name); | 504 AstNode* ParseForStatement(String* label_name); |
| 501 AstNode* ParseForInStatement(intptr_t forin_pos, SourceLabel* label); | 505 AstNode* ParseForInStatement(intptr_t forin_pos, SourceLabel* label); |
| 502 RawClass* CheckCaseExpressions(const GrowableArray<LiteralNode*>& values); | 506 RawClass* CheckCaseExpressions(const GrowableArray<LiteralNode*>& values); |
| 503 CaseNode* ParseCaseClause(LocalVariable* switch_expr_value, | 507 CaseNode* ParseCaseClause(LocalVariable* switch_expr_value, |
| 504 GrowableArray<LiteralNode*>* case_expr_values, | 508 GrowableArray<LiteralNode*>* case_expr_values, |
| 505 SourceLabel* case_label); | 509 SourceLabel* case_label); |
| 506 AstNode* ParseSwitchStatement(String* label_name); | 510 AstNode* ParseSwitchStatement(String* label_name); |
| 507 | 511 |
| 508 // try/catch/finally parsing. | 512 // try/catch/finally parsing. |
| 509 void AddCatchParamsToScope(const CatchParamDesc& exception_param, | 513 void AddCatchParamsToScope(CatchParamDesc* exception_param, |
| 510 const CatchParamDesc& stack_trace_param, | 514 CatchParamDesc* stack_trace_param, |
| 511 LocalScope* scope); | 515 LocalScope* scope); |
| 516 // Parse all the catch clause of a try. |
| 517 SequenceNode* ParseCatchClauses(intptr_t handler_pos, |
| 518 LocalVariable* exception_var, |
| 519 LocalVariable* stack_trace_var, |
| 520 const GrowableObjectArray& handler_types, |
| 521 bool* needs_stack_trace); |
| 512 // Parse finally block and create an AST for it. | 522 // Parse finally block and create an AST for it. |
| 513 SequenceNode* ParseFinallyBlock(); | 523 SequenceNode* ParseFinallyBlock(); |
| 514 // Adds try block to the list of try blocks seen so far. | 524 // Adds try block to the list of try blocks seen so far. |
| 515 void PushTryBlock(Block* try_block); | 525 void PushTryBlock(Block* try_block); |
| 516 // Pops the inner most try block from the list. | 526 // Pops the inner most try block from the list. |
| 517 TryBlocks* PopTryBlock(); | 527 TryBlocks* PopTryBlock(); |
| 518 // Add specified node to try block list so that it can be patched with | 528 // Add specified node to try block list so that it can be patched with |
| 519 // inlined finally code if needed. | 529 // inlined finally code if needed. |
| 520 void AddNodeForFinallyInlining(AstNode* node); | 530 void AddNodeForFinallyInlining(AstNode* node); |
| 521 // Add the inlined finally block to the specified node. | 531 // Add the inlined finally block to the specified node. |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 intptr_t last_used_try_index_; | 731 intptr_t last_used_try_index_; |
| 722 | 732 |
| 723 bool unregister_pending_function_; | 733 bool unregister_pending_function_; |
| 724 | 734 |
| 725 DISALLOW_COPY_AND_ASSIGN(Parser); | 735 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 726 }; | 736 }; |
| 727 | 737 |
| 728 } // namespace dart | 738 } // namespace dart |
| 729 | 739 |
| 730 #endif // VM_PARSER_H_ | 740 #endif // VM_PARSER_H_ |
| OLD | NEW |