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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart

Issue 1134063002: dart2js cps: Introduce GetStatic/SetStatic. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix SExpression parsing/unparsing Created 5 years, 7 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: pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
index 9f0b7a0cb543960c497a6feb3676b51a733983b9..000a8523307644e2daff297f2b58a100c5970a17 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
@@ -214,7 +214,7 @@ abstract class InteriorNode extends Node {
void set body(Expression body);
}
-/// Invoke a static function or static field getter/setter.
+/// Invoke a static function or static getter/setter.
class InvokeStatic extends Expression implements Invoke {
/// [FunctionElement] or [FieldElement].
final Entity target;
@@ -624,6 +624,34 @@ class GetField extends Primitive implements JsSpecificNode {
accept(Visitor visitor) => visitor.visitGetField(this);
}
+/// Reads the value of a static field or tears off a static method.
+class GetStatic extends Primitive {
+ final Element element;
+ final SourceInformation sourceInformation;
+
+ GetStatic(this.element, this.sourceInformation);
+
+ accept(Visitor visitor) => visitor.visitGetStatic(this);
+}
+
+/// Sets the value of a static field.
+class SetStatic extends Expression implements InteriorNode {
+ final Element element;
+ final Reference<Primitive> value;
+ Expression body;
+ final SourceInformation sourceInformation;
+
+ SetStatic(this.element, Primitive value, this.sourceInformation)
+ : this.value = new Reference<Primitive>(value);
+
+ Expression plug(Expression expr) {
+ assert(body == null);
+ return body = expr;
+ }
+
+ accept(Visitor visitor) => visitor.visitSetStatic(this);
+}
+
/// Creates an object for holding boxed variables captured by a closure.
class CreateBox extends Primitive implements JsSpecificNode {
accept(Visitor visitor) => visitor.visitCreateBox(this);
@@ -1005,6 +1033,7 @@ abstract class Visitor<T> {
T visitTypeOperator(TypeOperator node);
T visitSetMutableVariable(SetMutableVariable node);
T visitDeclareFunction(DeclareFunction node);
+ T visitSetStatic(SetStatic node);
// Definitions.
T visitLiteralList(LiteralList node);
@@ -1017,6 +1046,7 @@ abstract class Visitor<T> {
T visitContinuation(Continuation node);
T visitMutableVariable(MutableVariable node);
T visitNonTailThrow(NonTailThrow node);
+ T visitGetStatic(GetStatic node);
// JavaScript specific nodes.
@@ -1313,6 +1343,18 @@ class RecursiveVisitor implements Visitor {
processReference(node.object);
}
+ processGetStatic(GetStatic node) {}
+ visitGetStatic(GetStatic node) {
+ processGetStatic(node);
+ }
+
+ processSetStatic(SetStatic node) {}
+ visitSetStatic(SetStatic node) {
+ processSetStatic(node);
+ processReference(node.value);
+ visit(node.body);
+ }
+
processCreateBox(CreateBox node) {}
visitCreateBox(CreateBox node) {
processCreateBox(node);
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698