Index: pkg/compiler/lib/src/kernel/types.dart |
diff --git a/pkg/compiler/lib/src/kernel/types.dart b/pkg/compiler/lib/src/kernel/types.dart |
index 1182385c4693c66f49fb8f2466db843a2168981c..8782ad2d6bb4486a8d3f7755efd84675f35e5e62 100644 |
--- a/pkg/compiler/lib/src/kernel/types.dart |
+++ b/pkg/compiler/lib/src/kernel/types.dart |
@@ -6,14 +6,14 @@ part of dart2js.kernel.element_map; |
/// Support for subtype checks of kernel based [DartType]s. |
class _KernelDartTypes implements DartTypes { |
- final KernelToElementMap worldBuilder; |
+ final KernelToElementMap elementMap; |
final SubtypeVisitor subtypeVisitor; |
final PotentialSubtypeVisitor potentialSubtypeVisitor; |
- _KernelDartTypes(this.worldBuilder) |
- : this.subtypeVisitor = new _KernelSubtypeVisitor(worldBuilder), |
+ _KernelDartTypes(this.elementMap) |
+ : this.subtypeVisitor = new _KernelSubtypeVisitor(elementMap), |
this.potentialSubtypeVisitor = |
- new _KernelPotentialSubtypeVisitor(worldBuilder); |
+ new _KernelPotentialSubtypeVisitor(elementMap); |
@override |
bool isPotentialSubtype(DartType t, DartType s) { |
@@ -31,7 +31,17 @@ class _KernelDartTypes implements DartTypes { |
} |
@override |
- CommonElements get commonElements => worldBuilder.commonElements; |
+ InterfaceType getSupertype(ClassEntity cls) { |
+ return elementMap._getSuperType(cls); |
+ } |
+ |
+ @override |
+ InterfaceType asInstanceOf(InterfaceType type, ClassEntity cls) { |
+ return elementMap._asInstanceOf(type, cls); |
+ } |
+ |
+ @override |
+ CommonElements get commonElements => elementMap.commonElements; |
} |
class _KernelOrderedTypeSetBuilder extends OrderedTypeSetBuilderBase { |
@@ -79,13 +89,7 @@ abstract class _AbstractTypeRelationMixin implements AbstractTypeRelation { |
@override |
InterfaceType asInstanceOf(InterfaceType type, ClassEntity cls) { |
- OrderedTypeSet orderedTypeSet = elementMap._getOrderedTypeSet(type.element); |
- InterfaceType supertype = |
- orderedTypeSet.asInstanceOf(cls, elementMap._getHierarchyDepth(cls)); |
- if (supertype != null) { |
- supertype = elementMap._substByContext(supertype, type); |
- } |
- return supertype; |
+ return elementMap._asInstanceOf(type, cls); |
} |
} |