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 "vm/ast.h" | 10 #include "vm/ast.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 struct TopLevel; | 22 struct TopLevel; |
23 struct ClassDesc; | 23 struct ClassDesc; |
24 struct MemberDesc; | 24 struct MemberDesc; |
25 struct ParamList; | 25 struct ParamList; |
26 struct QualIdent; | 26 struct QualIdent; |
27 struct CatchParamDesc; | 27 struct CatchParamDesc; |
28 struct FieldInitExpression; | 28 struct FieldInitExpression; |
29 | 29 |
30 // The class ParsedFunction holds the result of parsing a function. | 30 // The class ParsedFunction holds the result of parsing a function. |
31 class ParsedFunction : ValueObject { | 31 class ParsedFunction : public ValueObject { |
32 public: | 32 public: |
33 static const int kFirstLocalSlotIndex = -2; | 33 static const int kFirstLocalSlotIndex = -2; |
34 | 34 |
35 explicit ParsedFunction(const Function& function) | 35 explicit ParsedFunction(const Function& function) |
36 : function_(function), | 36 : function_(function), |
37 node_sequence_(NULL), | 37 node_sequence_(NULL), |
38 instantiator_(NULL), | 38 instantiator_(NULL), |
39 default_parameter_values_(Array::Handle()), | 39 default_parameter_values_(Array::Handle()), |
40 saved_context_var_(NULL), | 40 saved_context_var_(NULL), |
41 expression_temp_var_(NULL), | 41 expression_temp_var_(NULL), |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 int first_parameter_index_; | 99 int first_parameter_index_; |
100 int first_stack_local_index_; | 100 int first_stack_local_index_; |
101 int copied_parameter_count_; | 101 int copied_parameter_count_; |
102 int stack_local_count_; | 102 int stack_local_count_; |
103 | 103 |
104 DISALLOW_COPY_AND_ASSIGN(ParsedFunction); | 104 DISALLOW_COPY_AND_ASSIGN(ParsedFunction); |
105 }; | 105 }; |
106 | 106 |
107 | 107 |
108 class Parser : ValueObject { | 108 class Parser : public ValueObject { |
109 public: | 109 public: |
110 Parser(const Script& script, const Library& library); | 110 Parser(const Script& script, |
| 111 const Library& library, |
| 112 bool generating_snapshot); |
111 Parser(const Script& script, const Function& function, intptr_t token_pos); | 113 Parser(const Script& script, const Function& function, intptr_t token_pos); |
112 | 114 |
113 // Parse the top level of a whole script file and register declared classes | 115 // Parse the top level of a whole script file and register declared classes |
114 // and interfaces in the given library. | 116 // and interfaces in the given library. |
115 static void ParseCompilationUnit(const Library& library, | 117 static void ParseCompilationUnit(const Library& library, |
116 const Script& script); | 118 const Script& script, |
| 119 bool generating_snapshot); |
117 | 120 |
118 static void ParseFunction(ParsedFunction* parsed_function); | 121 static void ParseFunction(ParsedFunction* parsed_function); |
119 | 122 |
120 // Format and print a message with source location. | 123 // Format and print a message with source location. |
121 // A null script means no source and a negative token_pos means no position. | 124 // A null script means no source and a negative token_pos means no position. |
122 static void PrintMessage(const Script& script, | 125 static void PrintMessage(const Script& script, |
123 intptr_t token_pos, | 126 intptr_t token_pos, |
124 const char* message_header, | 127 const char* message_header, |
125 const char* format, ...); | 128 const char* format, ...); |
126 | 129 |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 const Library& library_; | 587 const Library& library_; |
585 | 588 |
586 // List of try blocks seen so far, this is used to generate inlined finally | 589 // List of try blocks seen so far, this is used to generate inlined finally |
587 // code at all points in the try block where an exit from the block is | 590 // code at all points in the try block where an exit from the block is |
588 // done using 'return', 'break' or 'continue' statements. | 591 // done using 'return', 'break' or 'continue' statements. |
589 TryBlocks* try_blocks_list_; | 592 TryBlocks* try_blocks_list_; |
590 | 593 |
591 // Allocate temporary only once per function. | 594 // Allocate temporary only once per function. |
592 LocalVariable* expression_temp_; | 595 LocalVariable* expression_temp_; |
593 | 596 |
| 597 // Current class finalizer. |
| 598 ClassFinalizer class_finalizer_; |
| 599 |
594 DISALLOW_COPY_AND_ASSIGN(Parser); | 600 DISALLOW_COPY_AND_ASSIGN(Parser); |
595 }; | 601 }; |
596 | 602 |
597 } // namespace dart | 603 } // namespace dart |
598 | 604 |
599 #endif // VM_PARSER_H_ | 605 #endif // VM_PARSER_H_ |
OLD | NEW |