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

Unified Diff: sdk/lib/_internal/compiler/implementation/dart_backend/dart_tree.dart

Issue 329983002: Implement references to "this" in the new IR. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 6 years, 6 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
Index: sdk/lib/_internal/compiler/implementation/dart_backend/dart_tree.dart
diff --git a/sdk/lib/_internal/compiler/implementation/dart_backend/dart_tree.dart b/sdk/lib/_internal/compiler/implementation/dart_backend/dart_tree.dart
index 077829d9c8475b0c05d1c1614e5565876825ec57..e8f61d009c3b54fc390a098d0bfbc1c422e14394 100644
--- a/sdk/lib/_internal/compiler/implementation/dart_backend/dart_tree.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart_backend/dart_tree.dart
@@ -174,6 +174,10 @@ class Constant extends Expression {
accept(ExpressionVisitor visitor) => visitor.visitConstant(this);
}
+class This extends Expression {
+ accept(Visitor visitor) => visitor.visitThis(this);
+}
+
class LiteralList extends Expression {
final GenericType type;
final List<Expression> values;
@@ -421,6 +425,7 @@ abstract class ExpressionVisitor<E> {
E visitInvokeConstructor(InvokeConstructor node);
E visitConcatenateStrings(ConcatenateStrings node);
E visitConstant(Constant node);
+ E visitThis(This node);
E visitConditional(Conditional node);
E visitLogicalOperator(LogicalOperator node);
E visitNot(Not node);
@@ -808,6 +813,10 @@ class Builder extends ir.Visitor<Node> {
return new Constant(node.value);
}
+ Expression visitThis(ir.This node) {
+ return new This();
+ }
+
Expression visitLiteralList(ir.LiteralList node) {
return new LiteralList(
node.type,
@@ -1155,6 +1164,10 @@ class StatementRewriter extends Visitor<Statement, Expression> {
return node;
}
+ Expression visitThis(This node) {
+ return node;
+ }
+
Expression visitLiteralList(LiteralList node) {
// Process values right-to-left, the opposite of evaluation order.
for (int i = node.values.length - 1; i >= 0; --i) {
@@ -1667,6 +1680,10 @@ class LogicalRewriter extends Visitor<Statement, Expression> {
return node;
}
+ Expression visitThis(This node) {
+ return node;
+ }
+
Expression visitNot(Not node) {
return toBoolean(makeCondition(node.operand, false, liftNots: false));
}

Powered by Google App Engine
This is Rietveld 408576698