OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 library kernel.target.vm; | 4 library kernel.target.vm; |
5 | 5 |
6 import '../ast.dart'; | 6 import '../ast.dart'; |
7 import '../class_hierarchy.dart'; | 7 import '../class_hierarchy.dart'; |
8 import '../core_types.dart'; | 8 import '../core_types.dart'; |
9 import '../transformations/continuation.dart' as cont; | 9 import '../transformations/continuation.dart' as cont; |
10 import '../transformations/erasure.dart'; | 10 import '../transformations/erasure.dart'; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 if (flags.treeShake) { | 76 if (flags.treeShake) { |
77 performTreeShaking(program); | 77 performTreeShaking(program); |
78 } | 78 } |
79 | 79 |
80 cont.transformProgram(program); | 80 cont.transformProgram(program); |
81 | 81 |
82 // Repair `_getMainClosure()` function in dart:_builtin. | 82 // Repair `_getMainClosure()` function in dart:_builtin. |
83 setup_builtin_library.transformProgram(program); | 83 setup_builtin_library.transformProgram(program); |
84 | 84 |
85 if (strongMode) { | 85 if (strongMode) { |
86 new Erasure().transform(program); | 86 performErasure(program); |
87 } | 87 } |
88 | 88 |
89 new SanitizeForVM().transform(program); | 89 new SanitizeForVM().transform(program); |
90 } | 90 } |
91 | 91 |
92 void performTreeShaking(Program program) { | 92 void performTreeShaking(Program program) { |
93 var coreTypes = new CoreTypes(program); | 93 var coreTypes = new CoreTypes(program); |
94 new TreeShaker(program, | 94 new TreeShaker(program, |
95 hierarchy: _hierarchy, | 95 hierarchy: _hierarchy, |
96 coreTypes: coreTypes, | 96 coreTypes: coreTypes, |
97 strongMode: strongMode, | 97 strongMode: strongMode, |
98 programRoots: flags.programRoots) | 98 programRoots: flags.programRoots) |
99 .transform(program); | 99 .transform(program); |
100 _hierarchy = null; // Hierarchy must be recomputed. | 100 _hierarchy = null; // Hierarchy must be recomputed. |
101 } | 101 } |
| 102 |
| 103 void performErasure(Program program) { |
| 104 new Erasure().transform(program); |
| 105 } |
102 } | 106 } |
OLD | NEW |