| 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);
|
| }
|
| -}
|
| +}
|
|
|