| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 dart2js.world; | 5 library dart2js.world; |
| 6 | 6 |
| 7 import 'closure.dart' show ClosureClassElement, SynthesizedCallMethodElementX; | 7 import 'closure.dart' show ClosureClassElement, SynthesizedCallMethodElementX; |
| 8 import 'common/backend_api.dart' show BackendClasses; | 8 import 'common/backend_api.dart' show BackendClasses; |
| 9 import 'common.dart'; | 9 import 'common.dart'; |
| 10 import 'constants/constant_system.dart'; | 10 import 'constants/constant_system.dart'; |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 assert(checkInvariants(otherClass)); | 722 assert(checkInvariants(otherClass)); |
| 723 OrderedTypeSet otherTypeSet = otherClass.allSupertypesAndSelf; | 723 OrderedTypeSet otherTypeSet = otherClass.allSupertypesAndSelf; |
| 724 otherTypeSets = otherTypeSets.prepend(otherTypeSet); | 724 otherTypeSets = otherTypeSets.prepend(otherTypeSet); |
| 725 if (otherTypeSet.maxDepth < depth) { | 725 if (otherTypeSet.maxDepth < depth) { |
| 726 depth = otherTypeSet.maxDepth; | 726 depth = otherTypeSet.maxDepth; |
| 727 } | 727 } |
| 728 } while (iterator.moveNext()); | 728 } while (iterator.moveNext()); |
| 729 | 729 |
| 730 List<ClassElement> commonSupertypes = <ClassElement>[]; | 730 List<ClassElement> commonSupertypes = <ClassElement>[]; |
| 731 OUTER: | 731 OUTER: |
| 732 for (Link<DartType> link = typeSet[depth]; | 732 for (Link<ResolutionDartType> link = typeSet[depth]; |
| 733 link.head.element != commonElements.objectClass; | 733 link.head.element != commonElements.objectClass; |
| 734 link = link.tail) { | 734 link = link.tail) { |
| 735 ClassElement cls = link.head.element; | 735 ClassElement cls = link.head.element; |
| 736 for (Link<OrderedTypeSet> link = otherTypeSets; | 736 for (Link<OrderedTypeSet> link = otherTypeSets; |
| 737 !link.isEmpty; | 737 !link.isEmpty; |
| 738 link = link.tail) { | 738 link = link.tail) { |
| 739 if (link.head.asInstanceOf(cls) == null) { | 739 if (link.head.asInstanceOf(cls) == null) { |
| 740 continue OUTER; | 740 continue OUTER; |
| 741 } | 741 } |
| 742 } | 742 } |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 /// This method is only provided for testing. For queries on classes, use the | 935 /// This method is only provided for testing. For queries on classes, use the |
| 936 /// methods defined in [ClosedWorld]. | 936 /// methods defined in [ClosedWorld]. |
| 937 ClassSet getClassSet(ClassElement cls) { | 937 ClassSet getClassSet(ClassElement cls) { |
| 938 return _classSets[cls.declaration]; | 938 return _classSets[cls.declaration]; |
| 939 } | 939 } |
| 940 | 940 |
| 941 void registerClosureClass(ClosureClassElement cls) { | 941 void registerClosureClass(ClosureClassElement cls) { |
| 942 ClassHierarchyNode parentNode = getClassHierarchyNode(cls.superclass); | 942 ClassHierarchyNode parentNode = getClassHierarchyNode(cls.superclass); |
| 943 ClassHierarchyNode node = | 943 ClassHierarchyNode node = |
| 944 _classHierarchyNodes[cls] = new ClassHierarchyNode(parentNode, cls); | 944 _classHierarchyNodes[cls] = new ClassHierarchyNode(parentNode, cls); |
| 945 for (InterfaceType type in cls.allSupertypes) { | 945 for (ResolutionInterfaceType type in cls.allSupertypes) { |
| 946 ClassSet subtypeSet = getClassSet(type.element); | 946 ClassSet subtypeSet = getClassSet(type.element); |
| 947 subtypeSet.addSubtype(node); | 947 subtypeSet.addSubtype(node); |
| 948 } | 948 } |
| 949 _classSets[cls] = new ClassSet(node); | 949 _classSets[cls] = new ClassSet(node); |
| 950 _updateSuperClassHierarchyNodeForClass(node); | 950 _updateSuperClassHierarchyNodeForClass(node); |
| 951 node.isDirectlyInstantiated = true; | 951 node.isDirectlyInstantiated = true; |
| 952 } | 952 } |
| 953 | 953 |
| 954 void _updateSuperClassHierarchyNodeForClass(ClassHierarchyNode node) { | 954 void _updateSuperClassHierarchyNodeForClass(ClassHierarchyNode node) { |
| 955 // Ensure that classes implicitly implementing `Function` are in its | 955 // Ensure that classes implicitly implementing `Function` are in its |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 return getMightBePassedToApply(element.expression); | 1109 return getMightBePassedToApply(element.expression); |
| 1110 } | 1110 } |
| 1111 return functionsThatMightBePassedToApply.contains(element); | 1111 return functionsThatMightBePassedToApply.contains(element); |
| 1112 } | 1112 } |
| 1113 | 1113 |
| 1114 @override | 1114 @override |
| 1115 bool getCurrentlyKnownMightBePassedToApply(Element element) { | 1115 bool getCurrentlyKnownMightBePassedToApply(Element element) { |
| 1116 return getMightBePassedToApply(element); | 1116 return getMightBePassedToApply(element); |
| 1117 } | 1117 } |
| 1118 } | 1118 } |
| OLD | NEW |