Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(669)

Unified Diff: runtime/vm/ast.h

Issue 226953002: Implement deferred constant support (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/ast.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/ast.h
===================================================================
--- runtime/vm/ast.h (revision 34784)
+++ runtime/vm/ast.h (working copy)
@@ -440,7 +440,8 @@
: AstNode(token_pos),
function_(function),
receiver_(receiver),
- scope_(scope) {
+ scope_(scope),
+ is_deferred_reference_(false) {
ASSERT(function_.IsZoneHandle());
ASSERT((function_.IsNonImplicitClosureFunction() &&
(receiver_ == NULL) && (scope_ != NULL)) ||
@@ -454,6 +455,8 @@
AstNode* receiver() const { return receiver_; }
LocalScope* scope() const { return scope_; }
+ void set_is_deferred(bool value) { is_deferred_reference_ = value; }
+
virtual void VisitChildren(AstNodeVisitor* visitor) const {
if (receiver() != NULL) {
receiver()->Visit(visitor);
@@ -470,6 +473,7 @@
const Function& function_;
AstNode* receiver_;
LocalScope* scope_;
+ bool is_deferred_reference_;
DISALLOW_IMPLICIT_CONSTRUCTORS(ClosureNode);
};
@@ -482,12 +486,17 @@
class PrimaryNode : public AstNode {
public:
PrimaryNode(intptr_t token_pos, const Object& primary)
- : AstNode(token_pos), primary_(primary) {
+ : AstNode(token_pos),
+ primary_(primary),
+ is_deferred_reference_(false) {
ASSERT(primary_.IsNotTemporaryScopedHandle());
}
const Object& primary() const { return primary_; }
+ void set_is_deferred(bool value) { is_deferred_reference_ = value; }
+ bool is_deferred_reference() const { return is_deferred_reference_; }
+
bool IsSuper() const {
return primary().IsString() && (primary().raw() == Symbols::Super().raw());
}
@@ -498,6 +507,7 @@
private:
const Object& primary_;
+ bool is_deferred_reference_;
DISALLOW_IMPLICIT_CONSTRUCTORS(PrimaryNode);
};
@@ -669,7 +679,6 @@
};
-
class UnaryOpNode : public AstNode {
public:
// Returns optimized version, e.g., for ('-' '1') ('-1') literal is returned.
@@ -1139,11 +1148,12 @@
class LoadStaticFieldNode : public AstNode {
public:
LoadStaticFieldNode(intptr_t token_pos, const Field& field)
- : AstNode(token_pos), field_(field) {
+ : AstNode(token_pos), field_(field), is_deferred_reference_(false) {
ASSERT(field_.IsZoneHandle());
}
const Field& field() const { return field_; }
+ void set_is_deferred(bool value) { is_deferred_reference_ = value; }
virtual void VisitChildren(AstNodeVisitor* visitor) const { }
@@ -1155,13 +1165,16 @@
virtual const Instance* EvalConstExpr() const {
ASSERT(field_.is_static());
- return field_.is_const() ? &Instance::ZoneHandle(field_.value()) : NULL;
+ return !is_deferred_reference_ && field_.is_const()
+ ? &Instance::ZoneHandle(field_.value())
+ : NULL;
}
DECLARE_COMMON_NODE_FUNCTIONS(LoadStaticFieldNode);
private:
const Field& field_;
+ bool is_deferred_reference_;
DISALLOW_IMPLICIT_CONSTRUCTORS(LoadStaticFieldNode);
};
@@ -1385,7 +1398,8 @@
receiver_(receiver),
cls_(cls),
field_name_(field_name),
- is_super_getter_(is_super_getter) {
+ is_super_getter_(is_super_getter),
+ is_deferred_reference_(false) {
ASSERT(cls_.IsZoneHandle());
ASSERT(field_name_.IsZoneHandle());
ASSERT(field_name_.IsSymbol());
@@ -1401,6 +1415,7 @@
const Class& cls() const { return cls_; }
const String& field_name() const { return field_name_; }
bool is_super_getter() const { return is_super_getter_; }
+ void set_is_deferred(bool value) { is_deferred_reference_ = value; }
virtual void VisitChildren(AstNodeVisitor* visitor) const { }
@@ -1416,6 +1431,7 @@
const Class& cls_;
const String& field_name_;
const bool is_super_getter_;
+ bool is_deferred_reference_;
DISALLOW_IMPLICIT_CONSTRUCTORS(StaticGetterNode);
};
« no previous file with comments | « no previous file | runtime/vm/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698