Index: pkg/kernel/lib/target/vm.dart |
diff --git a/pkg/kernel/lib/target/vm.dart b/pkg/kernel/lib/target/vm.dart |
index 1366cae89f9e141531037064d183179c105de028..ed225449dd95610b8939b2bdcce16e0e4366092d 100644 |
--- a/pkg/kernel/lib/target/vm.dart |
+++ b/pkg/kernel/lib/target/vm.dart |
@@ -74,13 +74,7 @@ class VmTarget extends Target { |
} |
if (flags.treeShake) { |
- new TreeShaker(program, |
- hierarchy: _hierarchy, |
- coreTypes: coreTypes, |
- strongMode: strongMode, |
- programRoots: flags.programRoots) |
- .transform(program); |
- _hierarchy = null; // Hierarchy must be recomputed. |
+ performTreeShaking(program); |
} |
cont.transformProgram(program); |
@@ -94,4 +88,15 @@ class VmTarget extends Target { |
new SanitizeForVM().transform(program); |
} |
+ |
+ void performTreeShaking(Program program) { |
+ var coreTypes = new CoreTypes(program); |
+ new TreeShaker(program, |
+ hierarchy: _hierarchy, |
+ coreTypes: coreTypes, |
+ strongMode: strongMode, |
+ programRoots: flags.programRoots) |
+ .transform(program); |
+ _hierarchy = null; // Hierarchy must be recomputed. |
+ } |
} |