| 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_AST_H_ | 5 #ifndef VM_AST_H_ |
| 6 #define VM_AST_H_ | 6 #define VM_AST_H_ |
| 7 | 7 |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
| 10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 V(LoadStaticField) \ | 53 V(LoadStaticField) \ |
| 54 V(StoreStaticField) \ | 54 V(StoreStaticField) \ |
| 55 V(LoadIndexed) \ | 55 V(LoadIndexed) \ |
| 56 V(StoreIndexed) \ | 56 V(StoreIndexed) \ |
| 57 V(Sequence) \ | 57 V(Sequence) \ |
| 58 V(Let) \ | 58 V(Let) \ |
| 59 V(CatchClause) \ | 59 V(CatchClause) \ |
| 60 V(TryCatch) \ | 60 V(TryCatch) \ |
| 61 V(Throw) \ | 61 V(Throw) \ |
| 62 V(InlinedFinally) \ | 62 V(InlinedFinally) \ |
| 63 V(StringInterpolate) \ |
| 63 | 64 |
| 64 | 65 |
| 65 #define FORWARD_DECLARATION(BaseName) class BaseName##Node; | 66 #define FORWARD_DECLARATION(BaseName) class BaseName##Node; |
| 66 FOR_EACH_NODE(FORWARD_DECLARATION) | 67 FOR_EACH_NODE(FORWARD_DECLARATION) |
| 67 #undef FORWARD_DECLARATION | 68 #undef FORWARD_DECLARATION |
| 68 | 69 |
| 69 | 70 |
| 70 // Abstract class to implement an AST node visitor. An example is AstPrinter. | 71 // Abstract class to implement an AST node visitor. An example is AstPrinter. |
| 71 class AstNodeVisitor : public ValueObject { | 72 class AstNodeVisitor : public ValueObject { |
| 72 public: | 73 public: |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 ASSERT(type_.IsFinalized()); | 300 ASSERT(type_.IsFinalized()); |
| 300 // Type may be uninstantiated when creating a generic list literal. | 301 // Type may be uninstantiated when creating a generic list literal. |
| 301 ASSERT((type_.arguments() == AbstractTypeArguments::null()) || | 302 ASSERT((type_.arguments() == AbstractTypeArguments::null()) || |
| 302 ((AbstractTypeArguments::Handle(type_.arguments()).Length() == 1))); | 303 ((AbstractTypeArguments::Handle(type_.arguments()).Length() == 1))); |
| 303 } | 304 } |
| 304 | 305 |
| 305 DISALLOW_IMPLICIT_CONSTRUCTORS(ArrayNode); | 306 DISALLOW_IMPLICIT_CONSTRUCTORS(ArrayNode); |
| 306 }; | 307 }; |
| 307 | 308 |
| 308 | 309 |
| 310 class StringInterpolateNode : public AstNode { |
| 311 public: |
| 312 StringInterpolateNode(intptr_t token_pos, ArrayNode* value) |
| 313 : AstNode(token_pos), value_(value) { } |
| 314 |
| 315 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
| 316 value_->Visit(visitor); |
| 317 } |
| 318 |
| 319 ArrayNode* value() const { return value_; } |
| 320 |
| 321 DECLARE_COMMON_NODE_FUNCTIONS(StringInterpolateNode); |
| 322 |
| 323 private: |
| 324 ArrayNode* value_; |
| 325 |
| 326 DISALLOW_IMPLICIT_CONSTRUCTORS(StringInterpolateNode); |
| 327 }; |
| 328 |
| 329 |
| 309 class LiteralNode : public AstNode { | 330 class LiteralNode : public AstNode { |
| 310 public: | 331 public: |
| 311 LiteralNode(intptr_t token_pos, const Instance& literal) | 332 LiteralNode(intptr_t token_pos, const Instance& literal) |
| 312 : AstNode(token_pos), literal_(literal) { | 333 : AstNode(token_pos), literal_(literal) { |
| 313 ASSERT(literal_.IsNotTemporaryScopedHandle()); | 334 ASSERT(literal_.IsNotTemporaryScopedHandle()); |
| 314 ASSERT(literal_.IsSmi() || literal_.IsOld()); | 335 ASSERT(literal_.IsSmi() || literal_.IsOld()); |
| 315 #if defined(DEBUG) | 336 #if defined(DEBUG) |
| 316 if (literal_.IsString()) { | 337 if (literal_.IsString()) { |
| 317 ASSERT(String::Cast(literal_).IsSymbol()); | 338 ASSERT(String::Cast(literal_).IsSymbol()); |
| 318 } | 339 } |
| (...skipping 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1757 const intptr_t try_index_; | 1778 const intptr_t try_index_; |
| 1758 | 1779 |
| 1759 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); | 1780 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); |
| 1760 }; | 1781 }; |
| 1761 | 1782 |
| 1762 } // namespace dart | 1783 } // namespace dart |
| 1763 | 1784 |
| 1764 #undef DECLARE_COMMON_NODE_FUNCTIONS | 1785 #undef DECLARE_COMMON_NODE_FUNCTIONS |
| 1765 | 1786 |
| 1766 #endif // VM_AST_H_ | 1787 #endif // VM_AST_H_ |
| OLD | NEW |