Chromium Code Reviews| 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) { prefix_ = prefix; } |
|
rmacnak
2017/01/05 22:50:11
prefix -> deferred_prefix
ASSERT(prefix.is_deferr
Florian Schneider
2017/01/06 02:12:12
Done.
| |
| 574 bool is_deferred_reference() const { return is_deferred_reference_; } | 574 const LibraryPrefix* prefix() const { return prefix_; } |
| 575 bool is_deferred_reference() const { return prefix_ != NULL; } | |
| 575 | 576 |
| 576 bool IsSuper() const { | 577 bool IsSuper() const { |
| 577 return primary().IsString() && (primary().raw() == Symbols::Super().raw()); | 578 return primary().IsString() && (primary().raw() == Symbols::Super().raw()); |
| 578 } | 579 } |
| 579 | 580 |
| 580 virtual void VisitChildren(AstNodeVisitor* visitor) const; | 581 virtual void VisitChildren(AstNodeVisitor* visitor) const; |
| 581 | 582 |
| 582 DECLARE_COMMON_NODE_FUNCTIONS(PrimaryNode); | 583 DECLARE_COMMON_NODE_FUNCTIONS(PrimaryNode); |
| 583 | 584 |
| 584 private: | 585 private: |
| 585 const Object& primary_; | 586 const Object& primary_; |
| 586 bool is_deferred_reference_; | 587 const LibraryPrefix* prefix_; |
|
hausner
2017/01/05 21:50:44
We don't typically store pointers to handles in th
Florian Schneider
2017/01/05 22:07:16
I'd have to allocate an extra handle per PrimaryNo
hausner
2017/01/05 22:39:40
Fine with me. Yes, otherwise you'd have to allocat
| |
| 587 | 588 |
| 588 DISALLOW_IMPLICIT_CONSTRUCTORS(PrimaryNode); | 589 DISALLOW_IMPLICIT_CONSTRUCTORS(PrimaryNode); |
| 589 }; | 590 }; |
| 590 | 591 |
| 591 // In asynchronous code that gets suspended and resumed, return nodes | 592 // In asynchronous code that gets suspended and resumed, return nodes |
| 592 // can be of different types: | 593 // can be of different types: |
| 593 // * A regular return node that in the case of async functions | 594 // * A regular return node that in the case of async functions |
| 594 // gets replaced with appropriate completer calls. (kRegular) | 595 // gets replaced with appropriate completer calls. (kRegular) |
| 595 // * A continuation return that just returns from a function, without | 596 // * A continuation return that just returns from a function, without |
| 596 // completing the Future. (kContinuation) | 597 // completing the Future. (kContinuation) |
| (...skipping 1365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1962 const intptr_t try_index_; | 1963 const intptr_t try_index_; |
| 1963 | 1964 |
| 1964 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); | 1965 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); |
| 1965 }; | 1966 }; |
| 1966 | 1967 |
| 1967 } // namespace dart | 1968 } // namespace dart |
| 1968 | 1969 |
| 1969 #undef DECLARE_COMMON_NODE_FUNCTIONS | 1970 #undef DECLARE_COMMON_NODE_FUNCTIONS |
| 1970 | 1971 |
| 1971 #endif // RUNTIME_VM_AST_H_ | 1972 #endif // RUNTIME_VM_AST_H_ |
| OLD | NEW |