Index: pkg/kernel/lib/target/vm.dart |
diff --git a/pkg/kernel/lib/target/vm.dart b/pkg/kernel/lib/target/vm.dart |
index d2643f5b5bdec5feaee1acb2cfc7e007806aa86b..8d4f84984614fc317537248fceb9ac9ab6d8efc6 100644 |
--- a/pkg/kernel/lib/target/vm.dart |
+++ b/pkg/kernel/lib/target/vm.dart |
@@ -4,6 +4,7 @@ |
library kernel.target.vm; |
import '../ast.dart'; |
+import '../class_hierarchy.dart'; |
import '../core_types.dart'; |
import '../transformations/continuation.dart' as cont; |
import '../transformations/erasure.dart'; |
@@ -55,8 +56,7 @@ class VmTarget extends Target { |
]; |
void transformProgram(Program program) { |
- var mixins = new mix.MixinFullResolution(); |
- mixins.transform(program); |
+ var mixins = new mix.MixinFullResolution()..transform(program); |
var hierarchy = mixins.hierarchy; |
var coreTypes = new CoreTypes(program); |
@@ -68,11 +68,13 @@ class VmTarget extends Target { |
.transformProgram(program); |
} |
- if (program.mainMethod != null) { |
+ if (flags.treeShake) { |
new TreeShaker(program, |
- hierarchy: hierarchy, coreTypes: coreTypes, |
+ hierarchy: hierarchy, |
+ coreTypes: coreTypes, |
strongMode: strongMode) |
.transform(program); |
+ hierarchy = null; // Hierarchy must be recomputed. |
} |
cont.transformProgram(program); |