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.transformations.erasure; | 4 library kernel.transformations.erasure; |
5 | 5 |
6 import '../ast.dart'; | 6 import '../ast.dart'; |
7 import '../type_algebra.dart'; | 7 import '../type_algebra.dart'; |
| 8 import '../core_types.dart'; |
| 9 |
| 10 Program transformProgram(CoreTypes coreTypes, Program program) { |
| 11 program.accept(new Erasure()); |
| 12 } |
| 13 |
| 14 void transformLibraries(CoreTypes coreTypes, List<Library> libraries) { |
| 15 Erasure erasure = new Erasure(); |
| 16 for (Library library in libraries) { |
| 17 library.accept(erasure); |
| 18 } |
| 19 } |
8 | 20 |
9 /// This pass is a temporary measure to run strong mode code in the VM, which | 21 /// This pass is a temporary measure to run strong mode code in the VM, which |
10 /// does not yet have the necessary runtime support. | 22 /// does not yet have the necessary runtime support. |
11 /// | 23 /// |
12 /// Function type parameter lists are cleared and all uses of a function type | 24 /// Function type parameter lists are cleared and all uses of a function type |
13 /// parameter are replaced by its upper bound. | 25 /// parameter are replaced by its upper bound. |
14 /// | 26 /// |
15 /// All uses of type parameters in constants are replaced by 'dynamic'. | 27 /// All uses of type parameters in constants are replaced by 'dynamic'. |
16 /// | 28 /// |
17 /// This does not preserve dynamic type safety. | 29 /// This does not preserve dynamic type safety. |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 150 } |
139 | 151 |
140 @override | 152 @override |
141 visitMapLiteral(MapLiteral node) { | 153 visitMapLiteral(MapLiteral node) { |
142 if (node.isConst) pushConstantContext(); | 154 if (node.isConst) pushConstantContext(); |
143 node.transformChildren(this); | 155 node.transformChildren(this); |
144 if (node.isConst) popConstantContext(); | 156 if (node.isConst) popConstantContext(); |
145 return node; | 157 return node; |
146 } | 158 } |
147 } | 159 } |
OLD | NEW |