Index: pkg/compiler/lib/src/universe/class_set.dart |
diff --git a/pkg/compiler/lib/src/universe/class_set.dart b/pkg/compiler/lib/src/universe/class_set.dart |
index 3eaf8cbe0af8f0420e320a777876f78110b583dc..9df3c2d5b1366f4102f90fdb6a45db6b4164c143 100644 |
--- a/pkg/compiler/lib/src/universe/class_set.dart |
+++ b/pkg/compiler/lib/src/universe/class_set.dart |
@@ -228,6 +228,11 @@ class ClassHierarchyNode { |
return false; |
} |
+ /// Returns `true` if `other.cls` is a subclass of [cls]. |
+ bool hasSubclass(ClassHierarchyNode other) { |
+ return contains(other); |
+ } |
+ |
/// `true` if [cls] has been directly, indirectly, or abstractly instantiated. |
bool get isInstantiated => |
isExplicitlyInstantiated || isIndirectlyInstantiated; |
@@ -480,6 +485,20 @@ class ClassSet { |
ClassEntity get cls => node.cls; |
+ /// Returns `true` if `other.cls` is a subclass of [cls]. |
+ bool hasSubclass(ClassHierarchyNode other) => node.hasSubclass(other); |
+ |
+ /// Returns `true` if `other.cls` is a subtype of [cls]. |
+ bool hasSubtype(ClassHierarchyNode other) { |
+ if (hasSubclass(other)) return true; |
+ if (_subtypes != null) { |
+ for (ClassHierarchyNode subtypeNode in _subtypes) { |
+ if (subtypeNode.hasSubclass(other)) return true; |
+ } |
+ } |
+ return false; |
+ } |
+ |
/// Returns the number of directly instantiated subtypes of [cls]. |
int get instantiatedSubtypeCount { |
int count = node.instantiatedSubclassCount; |