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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 public: | 338 public: |
339 TypeNode(intptr_t token_pos, const AbstractType& type) | 339 TypeNode(intptr_t token_pos, const AbstractType& type) |
340 : AstNode(token_pos), type_(type) { | 340 : AstNode(token_pos), type_(type) { |
341 ASSERT(type_.IsZoneHandle()); | 341 ASSERT(type_.IsZoneHandle()); |
342 ASSERT(!type_.IsNull()); | 342 ASSERT(!type_.IsNull()); |
343 ASSERT(type_.IsFinalized()); | 343 ASSERT(type_.IsFinalized()); |
344 } | 344 } |
345 | 345 |
346 const AbstractType& type() const { return type_; } | 346 const AbstractType& type() const { return type_; } |
347 | 347 |
| 348 virtual const Instance* EvalConstExpr() const { |
| 349 if (!type_.IsInstantiated() || type_.IsMalformed()) { |
| 350 return NULL; |
| 351 } |
| 352 return &type(); |
| 353 } |
| 354 |
348 virtual void VisitChildren(AstNodeVisitor* visitor) const { } | 355 virtual void VisitChildren(AstNodeVisitor* visitor) const { } |
349 | 356 |
350 DECLARE_COMMON_NODE_FUNCTIONS(TypeNode); | 357 DECLARE_COMMON_NODE_FUNCTIONS(TypeNode); |
351 | 358 |
352 private: | 359 private: |
353 const AbstractType& type_; | 360 const AbstractType& type_; |
354 | 361 |
355 DISALLOW_IMPLICIT_CONSTRUCTORS(TypeNode); | 362 DISALLOW_IMPLICIT_CONSTRUCTORS(TypeNode); |
356 }; | 363 }; |
357 | 364 |
(...skipping 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1692 const LocalVariable& context_var_; | 1699 const LocalVariable& context_var_; |
1693 | 1700 |
1694 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); | 1701 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); |
1695 }; | 1702 }; |
1696 | 1703 |
1697 } // namespace dart | 1704 } // namespace dart |
1698 | 1705 |
1699 #undef DECLARE_COMMON_NODE_FUNCTIONS | 1706 #undef DECLARE_COMMON_NODE_FUNCTIONS |
1700 | 1707 |
1701 #endif // VM_AST_H_ | 1708 #endif // VM_AST_H_ |
OLD | NEW |