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

Unified Diff: pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart

Issue 759193005: Add support for fields to the new dart backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase Created 6 years, 1 month 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 | « pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart ('k') | pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart
diff --git a/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart b/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart
index cccca2ef10e8f656ae655b20659d058a3b433dac..ac8e464d82c6eb6cb35e381b1f5281c11a51bc42 100644
--- a/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart
+++ b/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart
@@ -11,6 +11,7 @@ import '../dart_types.dart' show DartType, GenericType;
import '../elements/elements.dart';
import '../universe/universe.dart';
import '../universe/universe.dart' show Selector;
+import 'optimization/optimization.dart';
// The Tree language is the target of translation out of the CPS-based IR.
//
@@ -86,7 +87,7 @@ class Label {
*/
class Variable extends Expression {
/// Function that declares this variable.
- FunctionDefinition host;
+ ExecutableElement host;
/// [Entity] used for synthesizing a name for the variable.
/// Different variables may have the same entity. May be null.
@@ -492,7 +493,23 @@ class ExpressionStatement extends Statement {
accept(StatementVisitor visitor) => visitor.visitExpressionStatement(this);
}
-class FunctionDefinition extends Node {
+abstract class ExecutableDefinition {
+ ExecutableElement get element;
+ Statement body;
+
+ applyPass(Pass pass);
+}
+
+class FieldDefinition extends Node implements ExecutableDefinition {
+ final FieldElement element;
+ // The `body` of a field is its initializer.
+ Statement body;
+
+ FieldDefinition(this.element, this.body);
+ applyPass(Pass pass) => pass.rewriteFieldDefinition(this);
+}
+
+class FunctionDefinition extends Node implements ExecutableDefinition {
final FunctionElement element;
final List<Variable> parameters;
Statement body;
@@ -506,6 +523,7 @@ class FunctionDefinition extends Node {
///
/// If `true` [body] is `null` and [localConstants] is empty.
bool get isAbstract => body == null;
+ applyPass(Pass pass) => pass.rewriteFunctionDefinition(this);
}
abstract class ExpressionVisitor<E> {
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart ('k') | pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698