| Index: pkg/compiler/lib/src/world.dart
|
| diff --git a/pkg/compiler/lib/src/world.dart b/pkg/compiler/lib/src/world.dart
|
| index 25d9e8199cf586ffec1fe3c0b75bc3231dd65cb1..907ef5743dda447a5bff1dde3db694729b0e1454 100644
|
| --- a/pkg/compiler/lib/src/world.dart
|
| +++ b/pkg/compiler/lib/src/world.dart
|
| @@ -472,6 +472,8 @@ abstract class ClosedWorldBase implements ClosedWorld, ClosedWorldRefiner {
|
|
|
| bool _checkClass(ClassEntity cls);
|
|
|
| + bool _checkInvariants(ClassEntity cls, {bool mustBeInstantiated: true});
|
| +
|
| @override
|
| bool isInstantiated(ClassEntity cls) {
|
| assert(_checkClass(cls));
|
| @@ -515,6 +517,21 @@ abstract class ClosedWorldBase implements ClosedWorld, ClosedWorldRefiner {
|
| return _resolverWorld.isImplemented(cls);
|
| }
|
|
|
| + /// Returns `true` if [x] is a subtype of [y], that is, if [x] implements an
|
| + /// instance of [y].
|
| + bool isSubtypeOf(ClassEntity x, ClassEntity y) {
|
| + assert(_checkInvariants(x));
|
| + assert(_checkInvariants(y, mustBeInstantiated: false));
|
| + return _classSets[y].hasSubtype(_classHierarchyNodes[x]);
|
| + }
|
| +
|
| + /// Return `true` if [x] is a (non-strict) subclass of [y].
|
| + bool isSubclassOf(ClassEntity x, ClassEntity y) {
|
| + assert(_checkInvariants(x));
|
| + assert(_checkInvariants(y));
|
| + return _classHierarchyNodes[y].hasSubclass(_classHierarchyNodes[x]);
|
| + }
|
| +
|
| /// Returns an iterable over the directly instantiated classes that extend
|
| /// [cls] possibly including [cls] itself, if it is live.
|
| Iterable<ClassEntity> subclassesOf(ClassEntity cls) {
|
| @@ -927,33 +944,6 @@ class ClosedWorldImpl extends ClosedWorldBase {
|
| ;
|
| }
|
|
|
| - /// Returns `true` if [x] is a subtype of [y], that is, if [x] implements an
|
| - /// instance of [y].
|
| - bool isSubtypeOf(ClassElement x, ClassElement y) {
|
| - assert(_checkInvariants(x));
|
| - assert(_checkInvariants(y, mustBeInstantiated: false));
|
| -
|
| - if (y == commonElements.objectClass) return true;
|
| - if (x == commonElements.objectClass) return false;
|
| - if (x.asInstanceOf(y) != null) return true;
|
| - if (y != commonElements.functionClass) return false;
|
| - return x.callType != null;
|
| - }
|
| -
|
| - /// Return `true` if [x] is a (non-strict) subclass of [y].
|
| - bool isSubclassOf(ClassElement x, ClassElement y) {
|
| - assert(_checkInvariants(x));
|
| - assert(_checkInvariants(y));
|
| -
|
| - if (y == commonElements.objectClass) return true;
|
| - if (x == commonElements.objectClass) return false;
|
| - while (x != null && x.hierarchyDepth >= y.hierarchyDepth) {
|
| - if (x == y) return true;
|
| - x = x.superclass;
|
| - }
|
| - return false;
|
| - }
|
| -
|
| /// Returns an iterable over the common supertypes of the [classes].
|
| Iterable<ClassElement> commonSupertypesOf(Iterable<ClassElement> classes) {
|
| Iterator<ClassElement> iterator = classes.iterator;
|
|
|