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

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

Issue 787603003: Generative constructors in the new dart backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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/cps_ir/optimizers.dart
diff --git a/pkg/compiler/lib/src/cps_ir/optimizers.dart b/pkg/compiler/lib/src/cps_ir/optimizers.dart
index 81f80bbcc05a83aada84df29da6605f7349de51f..566b8edc7a17706c5928b757720c0bf4baadb38d 100644
--- a/pkg/compiler/lib/src/cps_ir/optimizers.dart
+++ b/pkg/compiler/lib/src/cps_ir/optimizers.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-library dart2js.optimizers;
+library dart2js.cps_ir.optimizers;
import '../constants/expressions.dart' show
ConstantExpression,
@@ -22,10 +22,28 @@ part 'shrinking_reductions.dart';
abstract class Pass {
/// Applies optimizations to root, rewriting it in the process.
void rewrite(ExecutableDefinition root) => root.applyPass(this);
+
+ void rewriteConstructorDefinition(ConstructorDefinition root);
+ void rewriteFunctionDefinition(FunctionDefinition root);
+ void rewriteFieldDefinition(FieldDefinition root);
+}
+
+abstract class PassMixin implements Pass {
+ void rewrite(ExecutableDefinition root) => root.applyPass(this);
+
+ void rewriteExecutableDefinition(ExecutableDefinition root);
+
void rewriteFunctionDefinition(FunctionDefinition root) {
- return root.applyPass(this);
+ if (root.isAbstract) return;
+ rewriteExecutableDefinition(root);
+ }
+
+ void rewriteConstructorDefinition(ConstructorDefinition root) {
+ if (root.isAbstract) return;
+ rewriteExecutableDefinition(root);
}
void rewriteFieldDefinition(FieldDefinition root) {
- return root.applyPass(this);
+ if (!root.hasInitializer) return;
+ rewriteExecutableDefinition(root);
}
-}
+}

Powered by Google App Engine
This is Rietveld 408576698