| 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" | 10 #include "platform/assert.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 kParameterDefaultValueOffset, | 216 kParameterDefaultValueOffset, |
| 217 kParameterMetadataOffset, | 217 kParameterMetadataOffset, |
| 218 kParameterEntrySize, | 218 kParameterEntrySize, |
| 219 }; | 219 }; |
| 220 static RawObject* ParseFunctionParameters(const Function& func); | 220 static RawObject* ParseFunctionParameters(const Function& func); |
| 221 | 221 |
| 222 private: | 222 private: |
| 223 friend class EffectGraphVisitor; // For BuildNoSuchMethodArguments. | 223 friend class EffectGraphVisitor; // For BuildNoSuchMethodArguments. |
| 224 | 224 |
| 225 struct Block; | 225 struct Block; |
| 226 class TryBlocks; | 226 class TryStack; |
| 227 | 227 |
| 228 Parser(const Script& script, const Library& library, intptr_t token_pos); | 228 Parser(const Script& script, const Library& library, intptr_t token_pos); |
| 229 Parser(const Script& script, ParsedFunction* function, intptr_t token_pos); | 229 Parser(const Script& script, ParsedFunction* function, intptr_t token_pos); |
| 230 ~Parser(); | 230 ~Parser(); |
| 231 | 231 |
| 232 // The function for which we will generate code. | 232 // The function for which we will generate code. |
| 233 const Function& current_function() const; | 233 const Function& current_function() const; |
| 234 | 234 |
| 235 // The innermost function being parsed. | 235 // The innermost function being parsed. |
| 236 const Function& innermost_function() const; | 236 const Function& innermost_function() const; |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 LocalVariable* rethrow_exception_var, | 613 LocalVariable* rethrow_exception_var, |
| 614 LocalVariable* rethrow_stack_trace_var, | 614 LocalVariable* rethrow_stack_trace_var, |
| 615 const GrowableObjectArray& handler_types, | 615 const GrowableObjectArray& handler_types, |
| 616 bool* needs_stack_trace); | 616 bool* needs_stack_trace); |
| 617 // Parse finally block and create an AST for it. | 617 // Parse finally block and create an AST for it. |
| 618 SequenceNode* ParseFinallyBlock(bool is_async, | 618 SequenceNode* ParseFinallyBlock(bool is_async, |
| 619 LocalVariable* exception_var, | 619 LocalVariable* exception_var, |
| 620 LocalVariable* stack_trace_var, | 620 LocalVariable* stack_trace_var, |
| 621 LocalVariable* rethrow_exception_var, | 621 LocalVariable* rethrow_exception_var, |
| 622 LocalVariable* rethrow_stack_trace_var); | 622 LocalVariable* rethrow_stack_trace_var); |
| 623 // Adds try block to the list of try blocks seen so far. | 623 // Push try block onto the stack of try blocks in scope. |
| 624 void PushTryBlock(Block* try_block); | 624 void PushTry(Block* try_block); |
| 625 // Pops the inner most try block from the list. | 625 // Pop the inner most try block from the stack. |
| 626 TryBlocks* PopTryBlock(); | 626 TryStack* PopTry(); |
| 627 // Collect try block scopes and indices if await or yield is in try block. | 627 // Collect try block scopes and indices if await or yield is in try block. |
| 628 void CheckAsyncOpInTryBlock(LocalScope** try_scope, | 628 void CheckAsyncOpInTryBlock(LocalScope** try_scope, |
| 629 int16_t* try_index, | 629 int16_t* try_index, |
| 630 LocalScope** outer_try_scope, | 630 LocalScope** outer_try_scope, |
| 631 int16_t* outer_try_index) const; | 631 int16_t* outer_try_index) const; |
| 632 // Add specified node to try block list so that it can be patched with | 632 // Add specified node to try block list so that it can be patched with |
| 633 // inlined finally code if needed. | 633 // inlined finally code if needed. |
| 634 void AddNodeForFinallyInlining(AstNode* node); | 634 void AddNodeForFinallyInlining(AstNode* node); |
| 635 // Add the inlined finally block to the specified node. | 635 // Add the inlined finally block to the specified node. |
| 636 void AddFinallyBlockToNode(bool is_async, | 636 void AddFinallyBlockToNode(bool is_async, |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 // The class currently being parsed, or the owner class of the | 833 // The class currently being parsed, or the owner class of the |
| 834 // function currently being parsed. It is used for primary identifier lookups. | 834 // function currently being parsed. It is used for primary identifier lookups. |
| 835 Class& current_class_; | 835 Class& current_class_; |
| 836 | 836 |
| 837 // The current library (and thus class dictionary) used to resolve names. | 837 // The current library (and thus class dictionary) used to resolve names. |
| 838 // When parsing a function, this is the library in which the function | 838 // When parsing a function, this is the library in which the function |
| 839 // is defined. This can be the library in which the current_class_ is | 839 // is defined. This can be the library in which the current_class_ is |
| 840 // defined, or the library of a mixin class where the function originates. | 840 // defined, or the library of a mixin class where the function originates. |
| 841 Library& library_; | 841 Library& library_; |
| 842 | 842 |
| 843 // List of try blocks seen so far, this is used to generate inlined finally | 843 // Stack of try blocks in scope, this is used to generate inlined finally |
| 844 // code at all points in the try block where an exit from the block is | 844 // code at all points in the try block where an exit from the block is |
| 845 // done using 'return', 'break' or 'continue' statements. | 845 // done using 'return', 'break' or 'continue' statements. |
| 846 TryBlocks* try_blocks_list_; | 846 TryStack* try_stack_; |
| 847 | 847 |
| 848 // Each try in this function gets its own try index. | 848 // Each try in this function gets its own try index. |
| 849 int16_t AllocateTryIndex(); | 849 int16_t AllocateTryIndex(); |
| 850 | 850 |
| 851 int16_t last_used_try_index_; | 851 int16_t last_used_try_index_; |
| 852 | 852 |
| 853 bool unregister_pending_function_; | 853 bool unregister_pending_function_; |
| 854 | 854 |
| 855 LocalScope* async_temp_scope_; | 855 LocalScope* async_temp_scope_; |
| 856 | 856 |
| 857 // Indentation of parser trace. | 857 // Indentation of parser trace. |
| 858 intptr_t trace_indent_; | 858 intptr_t trace_indent_; |
| 859 | 859 |
| 860 DISALLOW_COPY_AND_ASSIGN(Parser); | 860 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 861 }; | 861 }; |
| 862 | 862 |
| 863 } // namespace dart | 863 } // namespace dart |
| 864 | 864 |
| 865 #endif // VM_PARSER_H_ | 865 #endif // VM_PARSER_H_ |
| OLD | NEW |