| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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_AST_H_ | 5 #ifndef VM_AST_H_ |
| 6 #define VM_AST_H_ | 6 #define VM_AST_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/assert.h" | 9 #include "vm/assert.h" |
| 10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 private: | 278 private: |
| 279 GrowableArray<AstNode*> nodes_; | 279 GrowableArray<AstNode*> nodes_; |
| 280 Array& names_; | 280 Array& names_; |
| 281 | 281 |
| 282 DISALLOW_COPY_AND_ASSIGN(ArgumentListNode); | 282 DISALLOW_COPY_AND_ASSIGN(ArgumentListNode); |
| 283 }; | 283 }; |
| 284 | 284 |
| 285 | 285 |
| 286 class ArrayNode : public AstNode { | 286 class ArrayNode : public AstNode { |
| 287 public: | 287 public: |
| 288 ArrayNode(intptr_t token_index, const TypeArguments& type_arguments) | 288 ArrayNode(intptr_t token_index, const AbstractTypeArguments& type_arguments) |
| 289 : AstNode(token_index), | 289 : AstNode(token_index), |
| 290 type_arguments_(type_arguments), | 290 type_arguments_(type_arguments), |
| 291 elements_(4) { | 291 elements_(4) { |
| 292 ASSERT(type_arguments_.IsZoneHandle()); | 292 ASSERT(type_arguments_.IsZoneHandle()); |
| 293 ASSERT(type_arguments.IsNull() || type_arguments_.IsInstantiated()); | 293 ASSERT(type_arguments.IsNull() || type_arguments_.IsInstantiated()); |
| 294 } | 294 } |
| 295 | 295 |
| 296 void VisitChildren(AstNodeVisitor* visitor) const; | 296 void VisitChildren(AstNodeVisitor* visitor) const; |
| 297 | 297 |
| 298 intptr_t length() const { return elements_.length(); } | 298 intptr_t length() const { return elements_.length(); } |
| 299 | 299 |
| 300 AstNode* ElementAt(intptr_t index) const { return elements_[index]; } | 300 AstNode* ElementAt(intptr_t index) const { return elements_[index]; } |
| 301 void SetElementAt(intptr_t index, AstNode* value) { | 301 void SetElementAt(intptr_t index, AstNode* value) { |
| 302 elements_[index] = value; | 302 elements_[index] = value; |
| 303 } | 303 } |
| 304 void AddElement(AstNode* expr) { elements_.Add(expr); } | 304 void AddElement(AstNode* expr) { elements_.Add(expr); } |
| 305 | 305 |
| 306 const TypeArguments& type_arguments() const { return type_arguments_; } | 306 const AbstractTypeArguments& type_arguments() const { |
| 307 return type_arguments_; |
| 308 } |
| 307 | 309 |
| 308 DECLARE_COMMON_NODE_FUNCTIONS(ArrayNode); | 310 DECLARE_COMMON_NODE_FUNCTIONS(ArrayNode); |
| 309 | 311 |
| 310 private: | 312 private: |
| 311 const TypeArguments& type_arguments_; | 313 const AbstractTypeArguments& type_arguments_; |
| 312 GrowableArray<AstNode*> elements_; | 314 GrowableArray<AstNode*> elements_; |
| 313 | 315 |
| 314 DISALLOW_IMPLICIT_CONSTRUCTORS(ArrayNode); | 316 DISALLOW_IMPLICIT_CONSTRUCTORS(ArrayNode); |
| 315 }; | 317 }; |
| 316 | 318 |
| 317 | 319 |
| 318 class LiteralNode : public AstNode { | 320 class LiteralNode : public AstNode { |
| 319 public: | 321 public: |
| 320 LiteralNode(intptr_t token_index, const Instance& literal) | 322 LiteralNode(intptr_t token_index, const Instance& literal) |
| 321 : AstNode(token_index), literal_(literal) { | 323 : AstNode(token_index), literal_(literal) { |
| (...skipping 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1691 // the receiver at an offset in the receiver specified by the provided | 1693 // the receiver at an offset in the receiver specified by the provided |
| 1692 // instantiator_class. | 1694 // instantiator_class. |
| 1693 // | 1695 // |
| 1694 // If the caller to the constructor or to the factory is a factory, then the | 1696 // If the caller to the constructor or to the factory is a factory, then the |
| 1695 // instantiator is the first parameter of this factory, which is already a | 1697 // instantiator is the first parameter of this factory, which is already a |
| 1696 // type argument vector. This case is identified by a null and unneeded | 1698 // type argument vector. This case is identified by a null and unneeded |
| 1697 // instantiator_class. | 1699 // instantiator_class. |
| 1698 class ConstructorCallNode : public AstNode { | 1700 class ConstructorCallNode : public AstNode { |
| 1699 public: | 1701 public: |
| 1700 ConstructorCallNode(intptr_t token_index, | 1702 ConstructorCallNode(intptr_t token_index, |
| 1701 const TypeArguments& type_arguments, | 1703 const AbstractTypeArguments& type_arguments, |
| 1702 const Function& constructor, | 1704 const Function& constructor, |
| 1703 ArgumentListNode* arguments) | 1705 ArgumentListNode* arguments) |
| 1704 : AstNode(token_index), | 1706 : AstNode(token_index), |
| 1705 type_arguments_(type_arguments), | 1707 type_arguments_(type_arguments), |
| 1706 constructor_(constructor), | 1708 constructor_(constructor), |
| 1707 arguments_(arguments) { | 1709 arguments_(arguments) { |
| 1708 ASSERT(type_arguments_.IsZoneHandle()); | 1710 ASSERT(type_arguments_.IsZoneHandle()); |
| 1709 ASSERT(constructor_.IsZoneHandle()); | 1711 ASSERT(constructor_.IsZoneHandle()); |
| 1710 ASSERT(arguments_ != NULL); | 1712 ASSERT(arguments_ != NULL); |
| 1711 } | 1713 } |
| 1712 | 1714 |
| 1713 const TypeArguments& type_arguments() const { return type_arguments_; } | 1715 const AbstractTypeArguments& type_arguments() const { |
| 1716 return type_arguments_; |
| 1717 } |
| 1714 const Function& constructor() const { return constructor_; } | 1718 const Function& constructor() const { return constructor_; } |
| 1715 ArgumentListNode* arguments() const { return arguments_; } | 1719 ArgumentListNode* arguments() const { return arguments_; } |
| 1716 | 1720 |
| 1717 virtual void VisitChildren(AstNodeVisitor* visitor) const { | 1721 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
| 1718 arguments()->Visit(visitor); | 1722 arguments()->Visit(visitor); |
| 1719 } | 1723 } |
| 1720 | 1724 |
| 1721 DECLARE_COMMON_NODE_FUNCTIONS(ConstructorCallNode); | 1725 DECLARE_COMMON_NODE_FUNCTIONS(ConstructorCallNode); |
| 1722 | 1726 |
| 1723 private: | 1727 private: |
| 1724 const TypeArguments& type_arguments_; | 1728 const AbstractTypeArguments& type_arguments_; |
| 1725 const Function& constructor_; | 1729 const Function& constructor_; |
| 1726 ArgumentListNode* arguments_; | 1730 ArgumentListNode* arguments_; |
| 1727 | 1731 |
| 1728 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstructorCallNode); | 1732 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstructorCallNode); |
| 1729 }; | 1733 }; |
| 1730 | 1734 |
| 1731 | 1735 |
| 1732 // The body of a Dart function marked as 'native' consists of this node. | 1736 // The body of a Dart function marked as 'native' consists of this node. |
| 1733 class NativeBodyNode : public AstNode { | 1737 class NativeBodyNode : public AstNode { |
| 1734 public: | 1738 public: |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1913 const LocalVariable& context_var_; | 1917 const LocalVariable& context_var_; |
| 1914 | 1918 |
| 1915 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); | 1919 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); |
| 1916 }; | 1920 }; |
| 1917 | 1921 |
| 1918 } // namespace dart | 1922 } // namespace dart |
| 1919 | 1923 |
| 1920 #undef DECLARE_COMMON_NODE_FUNCTIONS | 1924 #undef DECLARE_COMMON_NODE_FUNCTIONS |
| 1921 | 1925 |
| 1922 #endif // VM_AST_H_ | 1926 #endif // VM_AST_H_ |
| OLD | NEW |