Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Side by Side Diff: lib/transformations/treeshaker.dart

Issue 2439043002: Introduce Substitution class and Supertype class. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/text/ast_to_text.dart ('k') | lib/type_algebra.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « lib/text/ast_to_text.dart ('k') | lib/type_algebra.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698