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

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

Issue 787603003: Generative constructors in the new dart backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments, set element for constructors in frontend_ast_to_backend_ast, adjust status-file Created 6 years 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/tree_ir/tree_ir_tracer.dart
diff --git a/pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart b/pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart
index e78f426d528a5a819a02226876739ab12e5f047a..be1fb18cb1fb7e4969f7bfe37b7e89a6e413d84e 100644
--- a/pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart
+++ b/pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart
@@ -7,6 +7,7 @@ library tree_ir_tracer;
import 'dart:async' show EventSink;
import '../tracer.dart';
import 'tree_ir_nodes.dart';
+import 'optimization/optimization.dart';
class Block {
Label label;
@@ -52,6 +53,13 @@ class BlockCollector extends StatementVisitor {
void collect(ExecutableDefinition node) {
if (node.body != null) {
+ if (node is ConstructorDefinition) {
+ for (Initializer initializer in node.initializers) {
+ if (initializer is FieldInitializer) {
+ visitStatement(initializer.body);
+ }
+ }
+ }
visitStatement(node.body);
}
}
@@ -142,9 +150,10 @@ class BlockCollector extends StatementVisitor {
_addStatement(node);
visitStatement(node.next);
}
+
}
-class TreeTracer extends TracerUtil with StatementVisitor {
+class TreeTracer extends TracerUtil with StatementVisitor, PassMixin {
final EventSink<String> output;
TreeTracer(this.output);
@@ -154,16 +163,23 @@ class TreeTracer extends TracerUtil with StatementVisitor {
int statementCounter;
void traceGraph(String name, ExecutableDefinition node) {
- names = new Names();
- statementCounter = 0;
- collector = new BlockCollector();
- collector.collect(node);
+ if (node is FunctionDefinition && node.isAbstract) return;
+ if (node is FieldDefinition && node.body == null) return;
tag("cfg", () {
printProperty("name", name);
- int blockCounter = 0;
+ rewrite(node);
collector.blocks.forEach(printBlock);
});
- names = null;
+ }
+
+ @override
+ void rewriteExecutableDefinition(ExecutableDefinition node) {
+ collector = new BlockCollector();
+ names = new Names();
+ statementCounter = 0;
+ collector = new BlockCollector();
+ collector.collect(node);
+ collector.blocks.forEach(printBlock);
}
void printBlock(Block block) {
@@ -393,6 +409,14 @@ class SubexpressionVisitor extends ExpressionVisitor<String> {
return "function ${node.definition.element.name}";
}
+ String visitFieldInitializer(FieldInitializer node) {
+ throw "$node should not be visited by $this";
+ }
+
+ String visitSuperInitializer(SuperInitializer node) {
+ throw "$node should not be visited by $this";
+ }
+
}
/**
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart ('k') | tests/compiler/dart2js/backend_dart/sexpr_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698