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

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

Issue 979693003: Streamline the CPS IR Visitor interface. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Signal an error in visit methods that should not be called. Created 5 years, 10 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/type_propagation.dart
diff --git a/pkg/compiler/lib/src/cps_ir/type_propagation.dart b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
index ceef60f7d0d55da3cad40e76ef36fc4c2a421c3e..05a43c7f4cfc16f787d42ee38130b012b63ab732 100644
--- a/pkg/compiler/lib/src/cps_ir/type_propagation.dart
+++ b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
@@ -287,7 +287,7 @@ class _TransformingVisitor extends RecursiveVisitor {
* const-ness as well as reachability, both of which are used in the subsequent
* transformation pass.
*/
-class _TypePropagationVisitor<T> extends Visitor {
+class _TypePropagationVisitor<T> implements Visitor {
// The node worklist stores nodes that are both reachable and need to be
// processed, but have not been processed yet. Using a worklist avoids deep
// recursion.
@@ -411,26 +411,35 @@ class _TypePropagationVisitor<T> extends Visitor {
}
// -------------------------- Visitor overrides ------------------------------
+ void visit(Node node) { node.accept(this); }
- void visitNode(Node node) {
- internalError(NO_LOCATION_SPANNABLE,
- "_TypePropagationVisitor is stale,"
- " add missing visit overrides ($node)");
+ void visitFieldDefinition(FieldDefinition node) {
+ if (node.hasInitializer) {
+ setReachable(node.body);
+ }
}
- void visitRunnableBody(RunnableBody node) {
+ void visitFunctionDefinition(FunctionDefinition node) {
+ node.parameters.forEach(visit);
setReachable(node.body);
}
- void visitFunctionDefinition(FunctionDefinition node) {
+ void visitConstructorDefinition(ConstructorDefinition node) {
node.parameters.forEach(visit);
+ node.initializers.forEach(visit);
setReachable(node.body);
}
- void visitFieldDefinition(FieldDefinition node) {
- if (node.hasInitializer) {
- setReachable(node.body);
- }
+ void visitRunnableBody(RunnableBody node) {
+ setReachable(node.body);
+ }
+
+ void visitFieldInitializer(FieldInitializer node) {
+ setReachable(node.body);
+ }
+
+ void visitSuperInitializer(SuperInitializer node) {
+ node.arguments.forEach(setReachable);
}
// Expressions.
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart ('k') | pkg/compiler/lib/src/dart_backend/backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698