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

Unified Diff: pkg/compiler/lib/src/kernel/types.dart

Issue 2850143002: Reuse RuntimeTypesNeedBuilderImpl and _RuntimeTypesNeed for kernel based elements (Closed)
Patch Set: Fix comment Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
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);
}
}

Powered by Google App Engine
This is Rietveld 408576698