| 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 16 matching lines...) Expand all Loading... |
| 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 : ValueObject { |
| 32 public: | 32 public: |
| 33 explicit ParsedFunction(const Function& function) | 33 explicit ParsedFunction(const Function& function) |
| 34 : function_(function), | 34 : function_(function), |
| 35 node_sequence_(NULL), | 35 node_sequence_(NULL), |
| 36 instantiator_(NULL), | 36 instantiator_(NULL), |
| 37 default_parameter_values_(Array::Handle()) { } | 37 default_parameter_values_(Array::Handle()), |
| 38 first_parameter_index_(0), |
| 39 first_stack_local_index_(0), |
| 40 copied_parameter_count_(0), |
| 41 stack_local_count_(0) { } |
| 38 | 42 |
| 39 const Function& function() const { return function_; } | 43 const Function& function() const { return function_; } |
| 40 | 44 |
| 41 SequenceNode* node_sequence() const { return node_sequence_; } | 45 SequenceNode* node_sequence() const { return node_sequence_; } |
| 42 void set_node_sequence(SequenceNode* node_sequence) { | 46 void set_node_sequence(SequenceNode* node_sequence) { |
| 43 ASSERT(node_sequence != NULL); | 47 ASSERT(node_sequence != NULL); |
| 44 node_sequence_ = node_sequence; | 48 node_sequence_ = node_sequence; |
| 45 } | 49 } |
| 46 | 50 |
| 47 AstNode* instantiator() const { return instantiator_; } | 51 AstNode* instantiator() const { return instantiator_; } |
| 48 void set_instantiator(AstNode* instantiator) { | 52 void set_instantiator(AstNode* instantiator) { |
| 49 // May be NULL. | 53 // May be NULL. |
| 50 instantiator_ = instantiator; | 54 instantiator_ = instantiator; |
| 51 } | 55 } |
| 52 | 56 |
| 53 const Array& default_parameter_values() const { | 57 const Array& default_parameter_values() const { |
| 54 return default_parameter_values_; | 58 return default_parameter_values_; |
| 55 } | 59 } |
| 56 void set_default_parameter_values(const Array& default_parameter_values) { | 60 void set_default_parameter_values(const Array& default_parameter_values) { |
| 57 default_parameter_values_ = default_parameter_values.raw(); | 61 default_parameter_values_ = default_parameter_values.raw(); |
| 58 } | 62 } |
| 59 | 63 |
| 64 int first_parameter_index() const { return first_parameter_index_; } |
| 65 int first_stack_local_index() const { return first_stack_local_index_; } |
| 66 int copied_parameter_count() const { return copied_parameter_count_; } |
| 67 int stack_local_count() const { return stack_local_count_; } |
| 68 |
| 69 void AllocateVariables(); |
| 70 |
| 60 private: | 71 private: |
| 61 const Function& function_; | 72 const Function& function_; |
| 62 SequenceNode* node_sequence_; | 73 SequenceNode* node_sequence_; |
| 63 AstNode* instantiator_; | 74 AstNode* instantiator_; |
| 64 Array& default_parameter_values_; | 75 Array& default_parameter_values_; |
| 65 | 76 |
| 77 int first_parameter_index_; |
| 78 int first_stack_local_index_; |
| 79 int copied_parameter_count_; |
| 80 int stack_local_count_; |
| 81 |
| 66 DISALLOW_COPY_AND_ASSIGN(ParsedFunction); | 82 DISALLOW_COPY_AND_ASSIGN(ParsedFunction); |
| 67 }; | 83 }; |
| 68 | 84 |
| 69 | 85 |
| 70 class Parser : ValueObject { | 86 class Parser : ValueObject { |
| 71 public: | 87 public: |
| 72 Parser(const Script& script, const Library& library); | 88 Parser(const Script& script, const Library& library); |
| 73 Parser(const Script& script, | 89 Parser(const Script& script, |
| 74 const Function& function, | 90 const Function& function, |
| 75 intptr_t token_index); | 91 intptr_t token_index); |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 // code at all points in the try block where an exit from the block is | 496 // code at all points in the try block where an exit from the block is |
| 481 // done using 'return', 'break' or 'continue' statements. | 497 // done using 'return', 'break' or 'continue' statements. |
| 482 TryBlocks* try_blocks_list_; | 498 TryBlocks* try_blocks_list_; |
| 483 | 499 |
| 484 DISALLOW_COPY_AND_ASSIGN(Parser); | 500 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 485 }; | 501 }; |
| 486 | 502 |
| 487 } // namespace dart | 503 } // namespace dart |
| 488 | 504 |
| 489 #endif // VM_PARSER_H_ | 505 #endif // VM_PARSER_H_ |
| OLD | NEW |