| 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" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 static void AddImplicitConstructor(const Class& cls); | 175 static void AddImplicitConstructor(const Class& cls); |
| 176 | 176 |
| 177 private: | 177 private: |
| 178 friend class EffectGraphVisitor; // For BuildNoSuchMethodArguments. | 178 friend class EffectGraphVisitor; // For BuildNoSuchMethodArguments. |
| 179 | 179 |
| 180 struct Block; | 180 struct Block; |
| 181 class TryBlocks; | 181 class TryBlocks; |
| 182 | 182 |
| 183 Parser(const Script& script, const Library& library, intptr_t token_pos); | 183 Parser(const Script& script, const Library& library, intptr_t token_pos); |
| 184 Parser(const Script& script, ParsedFunction* function, intptr_t token_pos); | 184 Parser(const Script& script, ParsedFunction* function, intptr_t token_pos); |
| 185 ~Parser(); |
| 185 | 186 |
| 186 // The function for which we will generate code. | 187 // The function for which we will generate code. |
| 187 const Function& current_function() const; | 188 const Function& current_function() const; |
| 188 | 189 |
| 189 // The innermost function being parsed. | 190 // The innermost function being parsed. |
| 190 const Function& innermost_function() const; | 191 const Function& innermost_function() const; |
| 191 | 192 |
| 192 // Note that a local function may be parsed multiple times. It is first parsed | 193 // Note that a local function may be parsed multiple times. It is first parsed |
| 193 // when its outermost enclosing function is being parsed. It is then parsed | 194 // when its outermost enclosing function is being parsed. It is then parsed |
| 194 // again when an enclosing function calls this local function or calls | 195 // again when an enclosing function calls this local function or calls |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 PRINTF_ATTRIBUTE(3, 4); | 314 PRINTF_ATTRIBUTE(3, 4); |
| 314 | 315 |
| 315 // Reports an already formatted error message. | 316 // Reports an already formatted error message. |
| 316 static void ErrorMsg(const Error& error); | 317 static void ErrorMsg(const Error& error); |
| 317 | 318 |
| 318 // Concatenates two error messages, the previous and the current one. | 319 // Concatenates two error messages, the previous and the current one. |
| 319 void AppendErrorMsg( | 320 void AppendErrorMsg( |
| 320 const Error& prev_error, intptr_t token_pos, const char* format, ...) | 321 const Error& prev_error, intptr_t token_pos, const char* format, ...) |
| 321 PRINTF_ATTRIBUTE(4, 5); | 322 PRINTF_ATTRIBUTE(4, 5); |
| 322 | 323 |
| 324 void CheckRecursiveInvocation(); |
| 325 |
| 323 const Instance& EvaluateConstExpr(AstNode* expr); | 326 const Instance& EvaluateConstExpr(AstNode* expr); |
| 324 AstNode* RunStaticFieldInitializer(const Field& field); | 327 AstNode* RunStaticFieldInitializer(const Field& field); |
| 325 RawObject* EvaluateConstConstructorCall( | 328 RawObject* EvaluateConstConstructorCall( |
| 326 const Class& type_class, | 329 const Class& type_class, |
| 327 const AbstractTypeArguments& type_arguments, | 330 const AbstractTypeArguments& type_arguments, |
| 328 const Function& constructor, | 331 const Function& constructor, |
| 329 ArgumentListNode* arguments); | 332 ArgumentListNode* arguments); |
| 330 AstNode* FoldConstExpr(intptr_t expr_pos, AstNode* expr); | 333 AstNode* FoldConstExpr(intptr_t expr_pos, AstNode* expr); |
| 331 | 334 |
| 332 // Support for parsing of scripts. | 335 // Support for parsing of scripts. |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 | 689 |
| 687 // List of try blocks seen so far, this is used to generate inlined finally | 690 // List of try blocks seen so far, this is used to generate inlined finally |
| 688 // code at all points in the try block where an exit from the block is | 691 // code at all points in the try block where an exit from the block is |
| 689 // done using 'return', 'break' or 'continue' statements. | 692 // done using 'return', 'break' or 'continue' statements. |
| 690 TryBlocks* try_blocks_list_; | 693 TryBlocks* try_blocks_list_; |
| 691 | 694 |
| 692 // Each try in this function gets its own try index. | 695 // Each try in this function gets its own try index. |
| 693 intptr_t AllocateTryIndex() { return ++last_used_try_index_; } | 696 intptr_t AllocateTryIndex() { return ++last_used_try_index_; } |
| 694 intptr_t last_used_try_index_; | 697 intptr_t last_used_try_index_; |
| 695 | 698 |
| 699 bool unregister_pending_function_; |
| 700 |
| 696 DISALLOW_COPY_AND_ASSIGN(Parser); | 701 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 697 }; | 702 }; |
| 698 | 703 |
| 699 } // namespace dart | 704 } // namespace dart |
| 700 | 705 |
| 701 #endif // VM_PARSER_H_ | 706 #endif // VM_PARSER_H_ |
| OLD | NEW |