| 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 | 4 |
| 5 library kernel.tree_shaker; | 5 library kernel.tree_shaker; |
| 6 | 6 |
| 7 import '../ast.dart'; | 7 import '../ast.dart'; |
| 8 import '../class_hierarchy.dart'; | 8 import '../class_hierarchy.dart'; |
| 9 import '../core_types.dart'; | 9 import '../core_types.dart'; |
| 10 | 10 |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 | 655 |
| 656 Class visitClass(Class node) { | 656 Class visitClass(Class node) { |
| 657 switch (shaker.getClassRetention(node)) { | 657 switch (shaker.getClassRetention(node)) { |
| 658 case ClassRetention.None: | 658 case ClassRetention.None: |
| 659 return null; // Remove the class. | 659 return null; // Remove the class. |
| 660 | 660 |
| 661 case ClassRetention.Namespace: | 661 case ClassRetention.Namespace: |
| 662 // The class is only a namespace for static members. Remove its | 662 // The class is only a namespace for static members. Remove its |
| 663 // hierarchy information. This is mandatory, since these references | 663 // hierarchy information. This is mandatory, since these references |
| 664 // might otherwise become dangling. | 664 // might otherwise become dangling. |
| 665 node.supertype = shaker.coreTypes.objectClass.rawType; | 665 node.supertype = shaker.coreTypes.objectClass.asRawSupertype; |
| 666 node.implementedTypes.clear(); | 666 node.implementedTypes.clear(); |
| 667 node.typeParameters.clear(); | 667 node.typeParameters.clear(); |
| 668 // Mixin applications cannot have static members. | 668 // Mixin applications cannot have static members. |
| 669 assert(node.mixedInType == null); | 669 assert(node.mixedInType == null); |
| 670 // Unused members will be removed below. | 670 // Unused members will be removed below. |
| 671 break; | 671 break; |
| 672 | 672 |
| 673 case ClassRetention.Hierarchy: | 673 case ClassRetention.Hierarchy: |
| 674 case ClassRetention.Instance: | 674 case ClassRetention.Instance: |
| 675 case ClassRetention.ExternalInstance: | 675 case ClassRetention.ExternalInstance: |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 if (classNode.typeParameters.isEmpty) return false; | 768 if (classNode.typeParameters.isEmpty) return false; |
| 769 CoreTypes coreTypes = shaker.coreTypes; | 769 CoreTypes coreTypes = shaker.coreTypes; |
| 770 return classNode == coreTypes.iteratorClass || | 770 return classNode == coreTypes.iteratorClass || |
| 771 classNode == coreTypes.iterableClass || | 771 classNode == coreTypes.iterableClass || |
| 772 classNode == coreTypes.futureClass || | 772 classNode == coreTypes.futureClass || |
| 773 classNode == coreTypes.streamClass || | 773 classNode == coreTypes.streamClass || |
| 774 classNode == coreTypes.listClass || | 774 classNode == coreTypes.listClass || |
| 775 classNode == coreTypes.mapClass; | 775 classNode == coreTypes.mapClass; |
| 776 } | 776 } |
| 777 } | 777 } |
| OLD | NEW |