| Index: pkg/compiler/lib/src/universe/universe.dart
|
| diff --git a/pkg/compiler/lib/src/universe/universe.dart b/pkg/compiler/lib/src/universe/universe.dart
|
| index c8e39a43242f6954403302d51f42ddbef6938466..5f9fd4632487d19bd496ee8ea7d03e65a56f5380 100644
|
| --- a/pkg/compiler/lib/src/universe/universe.dart
|
| +++ b/pkg/compiler/lib/src/universe/universe.dart
|
| @@ -124,6 +124,12 @@ class Universe {
|
| /// See [_directlyInstantiatedClasses].
|
| final Set<DartType> _instantiatedTypes = new Set<DartType>();
|
|
|
| + /// The set of all instantiated classes, either directly, as superclasses or
|
| + /// as supertypes.
|
| + ///
|
| + /// Invariant: Elements are declaration elements.
|
| + final Set<ClassElement> _allInstantiatedClasses = new Set<ClassElement>();
|
| +
|
| /// Classes implemented by directly instantiated classes.
|
| final Set<ClassElement> _implementedClasses = new Set<ClassElement>();
|
|
|
| @@ -200,6 +206,13 @@ class Universe {
|
| return _directlyInstantiatedClasses;
|
| }
|
|
|
| + /// All instantiated classes, either directly, as superclasses or as
|
| + /// supertypes.
|
| + // TODO(johnniwinther): Improve semantic precision.
|
| + Iterable<ClassElement> get allInstantiatedClasses {
|
| + return _allInstantiatedClasses;
|
| + }
|
| +
|
| /// All directly instantiated types, that is, the types of the directly
|
| /// instantiated classes.
|
| ///
|
| @@ -207,6 +220,13 @@ class Universe {
|
| // TODO(johnniwinther): Improve semantic precision.
|
| Iterable<DartType> get instantiatedTypes => _instantiatedTypes;
|
|
|
| + /// Returns `true` if [cls] is considered to be instantiated, either directly,
|
| + /// through subclasses.
|
| + // TODO(johnniwinther): Improve semantic precision.
|
| + bool isInstantiated(ClassElement cls) {
|
| + return _allInstantiatedClasses.contains(cls.declaration);
|
| + }
|
| +
|
| /// Returns `true` if [cls] is considered to be implemented by an
|
| /// instantiated class, either directly, through subclasses or through
|
| /// subtypes. The latter case only contains spurious information from
|
| @@ -251,6 +271,12 @@ class Universe {
|
| }
|
| });
|
| }
|
| + while (cls != null) {
|
| + if (!_allInstantiatedClasses.add(cls)) {
|
| + return;
|
| + }
|
| + cls = cls.superclass;
|
| + }
|
| }
|
|
|
| bool _hasMatchingSelector(Map<Selector, SelectorConstraints> selectors,
|
| @@ -377,6 +403,7 @@ class Universe {
|
| fieldSetters.remove(element);
|
| fieldGetters.remove(element);
|
| _directlyInstantiatedClasses.remove(element);
|
| + _allInstantiatedClasses.remove(element);
|
| if (element is ClassElement) {
|
| assert(invariant(
|
| element, element.thisType.isRaw,
|
|
|