| 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 RUNTIME_VM_AST_H_ | 5 #ifndef RUNTIME_VM_AST_H_ |
| 6 #define RUNTIME_VM_AST_H_ | 6 #define RUNTIME_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 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 }; | 557 }; |
| 558 | 558 |
| 559 | 559 |
| 560 // Primary nodes hold identifiers or values (library, class or function) | 560 // Primary nodes hold identifiers or values (library, class or function) |
| 561 // resolved from an identifier. Primary nodes should not ever make it to the | 561 // resolved from an identifier. Primary nodes should not ever make it to the |
| 562 // code generation phase as they will be transformed into the correct call or | 562 // code generation phase as they will be transformed into the correct call or |
| 563 // field access nodes. | 563 // field access nodes. |
| 564 class PrimaryNode : public AstNode { | 564 class PrimaryNode : public AstNode { |
| 565 public: | 565 public: |
| 566 PrimaryNode(TokenPosition token_pos, const Object& primary) | 566 PrimaryNode(TokenPosition token_pos, const Object& primary) |
| 567 : AstNode(token_pos), primary_(primary), is_deferred_reference_(false) { | 567 : AstNode(token_pos), primary_(primary), prefix_(NULL) { |
| 568 ASSERT(primary_.IsNotTemporaryScopedHandle()); | 568 ASSERT(primary_.IsNotTemporaryScopedHandle()); |
| 569 } | 569 } |
| 570 | 570 |
| 571 const Object& primary() const { return primary_; } | 571 const Object& primary() const { return primary_; } |
| 572 | 572 |
| 573 void set_is_deferred(bool value) { is_deferred_reference_ = value; } | 573 void set_prefix(const LibraryPrefix* prefix) { |
| 574 bool is_deferred_reference() const { return is_deferred_reference_; } | 574 ASSERT(prefix->IsNotTemporaryScopedHandle()); |
| 575 prefix_ = prefix; |
| 576 } |
| 577 const LibraryPrefix* prefix() const { return prefix_; } |
| 578 bool is_deferred_reference() const { return prefix_ != NULL; } |
| 575 | 579 |
| 576 bool IsSuper() const { | 580 bool IsSuper() const { |
| 577 return primary().IsString() && (primary().raw() == Symbols::Super().raw()); | 581 return primary().IsString() && (primary().raw() == Symbols::Super().raw()); |
| 578 } | 582 } |
| 579 | 583 |
| 580 virtual void VisitChildren(AstNodeVisitor* visitor) const; | 584 virtual void VisitChildren(AstNodeVisitor* visitor) const; |
| 581 | 585 |
| 582 DECLARE_COMMON_NODE_FUNCTIONS(PrimaryNode); | 586 DECLARE_COMMON_NODE_FUNCTIONS(PrimaryNode); |
| 583 | 587 |
| 584 private: | 588 private: |
| 585 const Object& primary_; | 589 const Object& primary_; |
| 586 bool is_deferred_reference_; | 590 const LibraryPrefix* prefix_; |
| 587 | 591 |
| 588 DISALLOW_IMPLICIT_CONSTRUCTORS(PrimaryNode); | 592 DISALLOW_IMPLICIT_CONSTRUCTORS(PrimaryNode); |
| 589 }; | 593 }; |
| 590 | 594 |
| 591 // In asynchronous code that gets suspended and resumed, return nodes | 595 // In asynchronous code that gets suspended and resumed, return nodes |
| 592 // can be of different types: | 596 // can be of different types: |
| 593 // * A regular return node that in the case of async functions | 597 // * A regular return node that in the case of async functions |
| 594 // gets replaced with appropriate completer calls. (kRegular) | 598 // gets replaced with appropriate completer calls. (kRegular) |
| 595 // * A continuation return that just returns from a function, without | 599 // * A continuation return that just returns from a function, without |
| 596 // completing the Future. (kContinuation) | 600 // completing the Future. (kContinuation) |
| (...skipping 1365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1962 const intptr_t try_index_; | 1966 const intptr_t try_index_; |
| 1963 | 1967 |
| 1964 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); | 1968 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); |
| 1965 }; | 1969 }; |
| 1966 | 1970 |
| 1967 } // namespace dart | 1971 } // namespace dart |
| 1968 | 1972 |
| 1969 #undef DECLARE_COMMON_NODE_FUNCTIONS | 1973 #undef DECLARE_COMMON_NODE_FUNCTIONS |
| 1970 | 1974 |
| 1971 #endif // RUNTIME_VM_AST_H_ | 1975 #endif // RUNTIME_VM_AST_H_ |
| OLD | NEW |