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

Unified Diff: pkg/compiler/lib/src/universe/class_set.dart

Issue 2813853002: Use entity WorldImpl where possible (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/world.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 dd7f0636901c51b4c12300e95600044fe7bc9634..3eaf8cbe0af8f0420e320a777876f78110b583dc 100644
--- a/pkg/compiler/lib/src/universe/class_set.dart
+++ b/pkg/compiler/lib/src/universe/class_set.dart
@@ -19,7 +19,7 @@ enum Instantiation {
ABSTRACTLY_INSTANTIATED,
}
-/// Node for [cls] in a tree forming the subclass relation of [ClassElement]s.
+/// Node for [cls] in a tree forming the subclass relation of [ClassEntity]s.
///
/// This is used by the [ClosedWorld] to perform queries on subclass and subtype
/// relations.
@@ -101,7 +101,7 @@ class ClassHierarchyNode {
final int hierarchyDepth;
- ClassElement _leastUpperInstantiatedSubclass;
+ ClassEntity _leastUpperInstantiatedSubclass;
int _instantiatedSubclassCount = 0;
/// `true` if [cls] has been directly instantiated.
@@ -237,7 +237,7 @@ class ClassHierarchyNode {
/// Subclasses are included if their instantiation properties intersect with
/// their corresponding [Instantiation] values in [mask]. If [strict] is
/// `true`, [cls] itself is _not_ returned.
- Iterable<ClassElement> subclassesByMask(EnumSet<Instantiation> mask,
+ Iterable<ClassEntity> subclassesByMask(EnumSet<Instantiation> mask,
{bool strict: false}) {
return new ClassHierarchyNodeIterable(this, mask, includeRoot: !strict);
}
@@ -249,10 +249,9 @@ class ClassHierarchyNode {
/// [predicate] is applied to subclasses if their instantiation properties
/// intersect with their corresponding [Instantiation] values in [mask]. If
/// [strict] is `true`, [predicate] is _not_ called on [cls] itself.
- bool anySubclass(
- bool predicate(ClassElement cls), EnumSet<Instantiation> mask,
+ bool anySubclass(bool predicate(ClassEntity cls), EnumSet<Instantiation> mask,
{bool strict: false}) {
- IterationStep wrapper(ClassElement cls) {
+ IterationStep wrapper(ClassEntity cls) {
return predicate(cls) ? IterationStep.STOP : IterationStep.CONTINUE;
}
@@ -301,7 +300,7 @@ class ClassHierarchyNode {
/// Returns the most specific subclass of [cls] (including [cls]) that is
/// directly instantiated or a superclass of all directly instantiated
/// subclasses. If [cls] is not instantiated, `null` is returned.
- ClassElement getLubOfInstantiatedSubclasses() {
+ ClassEntity getLubOfInstantiatedSubclasses() {
if (!isInstantiated) return null;
if (_leastUpperInstantiatedSubclass == null) {
_leastUpperInstantiatedSubclass =
@@ -310,7 +309,7 @@ class ClassHierarchyNode {
return _leastUpperInstantiatedSubclass;
}
- ClassElement _computeLeastUpperInstantiatedSubclass() {
+ ClassEntity _computeLeastUpperInstantiatedSubclass() {
if (isExplicitlyInstantiated) {
return cls;
}
@@ -412,7 +411,7 @@ class ClassHierarchyNode {
}
/// Object holding the subclass and subtype relation for a single
-/// [ClassElement].
+/// [ClassEntity].
///
/// The subclass relation for a class `C` is modelled through a reference to
/// the [ClassHierarchyNode] for `C` in the global [ClassHierarchyNode] tree
@@ -457,7 +456,7 @@ class ClassHierarchyNode {
///
class ClassSet {
final ClassHierarchyNode node;
- ClassElement _leastUpperInstantiatedSubtype;
+ ClassEntity _leastUpperInstantiatedSubtype;
/// A list of the class hierarchy nodes for the subtypes that declare a
/// subtype relationship to [cls] either directly or indirectly.
@@ -479,7 +478,7 @@ class ClassSet {
ClassSet(this.node);
- ClassElement get cls => node.cls;
+ ClassEntity get cls => node.cls;
/// Returns the number of directly instantiated subtypes of [cls].
int get instantiatedSubtypeCount {
@@ -517,7 +516,7 @@ class ClassSet {
/// Subclasses are included if their instantiation properties intersect with
/// their corresponding [Instantiation] values in [mask]. If [strict] is
/// `true`, [cls] itself is _not_ returned.
- Iterable<ClassElement> subclassesByMask(EnumSet<Instantiation> mask,
+ Iterable<ClassEntity> subclassesByMask(EnumSet<Instantiation> mask,
{bool strict: false}) {
return node.subclassesByMask(mask, strict: strict);
}
@@ -528,7 +527,7 @@ class ClassSet {
/// subtypes of [cls] are returned if [includeDirectlyInstantiated],
/// [includeIndirectlyInstantiated], and [includeUninstantiated] are `true`,
/// respectively. If [strict] is `true`, [cls] itself is _not_ returned.
- Iterable<ClassElement> subtypes(
+ Iterable<ClassEntity> subtypes(
{bool includeDirectlyInstantiated: true,
bool includeIndirectlyInstantiated: true,
bool includeUninstantiated: true,
@@ -545,7 +544,7 @@ class ClassSet {
/// Subtypes are included if their instantiation properties intersect with
/// their corresponding [Instantiation] values in [mask]. If [strict] is
/// `true`, [cls] itself is _not_ returned.
- Iterable<ClassElement> subtypesByMask(EnumSet<Instantiation> mask,
+ Iterable<ClassEntity> subtypesByMask(EnumSet<Instantiation> mask,
{bool strict: false}) {
if (_subtypes == null) {
return node.subclassesByMask(mask, strict: strict);
@@ -562,8 +561,7 @@ class ClassSet {
/// [predicate] is applied to subclasses if their instantiation properties
/// intersect with their corresponding [Instantiation] values in [mask]. If
/// [strict] is `true`, [predicate] is _not_ called on [cls] itself.
- bool anySubclass(
- bool predicate(ClassElement cls), EnumSet<Instantiation> mask,
+ bool anySubclass(bool predicate(ClassEntity cls), EnumSet<Instantiation> mask,
{bool strict: false}) {
return node.anySubclass(predicate, mask, strict: strict);
}
@@ -594,9 +592,9 @@ class ClassSet {
/// [predicate] is applied to subtypes if their instantiation properties
/// intersect with their corresponding [Instantiation] values in [mask]. If
/// [strict] is `true`, [predicate] is _not_ called on [cls] itself.
- bool anySubtype(bool predicate(ClassElement cls), EnumSet<Instantiation> mask,
+ bool anySubtype(bool predicate(ClassEntity cls), EnumSet<Instantiation> mask,
{bool strict: false}) {
- IterationStep wrapper(ClassElement cls) {
+ IterationStep wrapper(ClassEntity cls) {
return predicate(cls) ? IterationStep.STOP : IterationStep.CONTINUE;
}
@@ -686,14 +684,14 @@ class ClassSet {
/// Returns the most specific subtype of [cls] (including [cls]) that is
/// directly instantiated or a superclass of all directly instantiated
/// subtypes. If no subtypes of [cls] are instantiated, `null` is returned.
- ClassElement getLubOfInstantiatedSubtypes() {
+ ClassEntity getLubOfInstantiatedSubtypes() {
if (_leastUpperInstantiatedSubtype == null) {
_leastUpperInstantiatedSubtype = _computeLeastUpperInstantiatedSubtype();
}
return _leastUpperInstantiatedSubtype;
}
- ClassElement _computeLeastUpperInstantiatedSubtype() {
+ ClassEntity _computeLeastUpperInstantiatedSubtype() {
if (node.isExplicitlyInstantiated) {
return cls;
}
@@ -736,7 +734,7 @@ class ClassSet {
}
/// Iterable for subclasses of a [ClassHierarchyNode].
-class ClassHierarchyNodeIterable extends IterableBase<ClassElement> {
+class ClassHierarchyNodeIterable extends IterableBase<ClassEntity> {
final ClassHierarchyNode root;
final EnumSet<Instantiation> mask;
final bool includeRoot;
@@ -746,7 +744,7 @@ class ClassHierarchyNodeIterable extends IterableBase<ClassElement> {
}
@override
- Iterator<ClassElement> get iterator {
+ Iterator<ClassEntity> get iterator {
return new ClassHierarchyNodeIterator(this);
}
}
@@ -754,7 +752,7 @@ class ClassHierarchyNodeIterable extends IterableBase<ClassElement> {
/// Iterator for subclasses of a [ClassHierarchyNode].
///
/// Classes are returned in pre-order DFS fashion.
-class ClassHierarchyNodeIterator implements Iterator<ClassElement> {
+class ClassHierarchyNodeIterator implements Iterator<ClassEntity> {
final ClassHierarchyNodeIterable iterable;
/// The class node holding the [current] class.
@@ -781,7 +779,7 @@ class ClassHierarchyNodeIterator implements Iterator<ClassElement> {
}
@override
- ClassElement get current {
+ ClassEntity get current {
return currentNode != null ? currentNode.cls : null;
}
@@ -833,7 +831,7 @@ class ClassHierarchyNodeIterator implements Iterator<ClassElement> {
}
/// Iterable for the subtypes in a [ClassSet].
-class SubtypesIterable extends IterableBase<ClassElement> {
+class SubtypesIterable extends IterableBase<ClassEntity> {
final ClassSet subtypeSet;
final EnumSet<Instantiation> mask;
final bool includeRoot;
@@ -842,13 +840,13 @@ class SubtypesIterable extends IterableBase<ClassElement> {
{this.includeRoot: true});
@override
- Iterator<ClassElement> get iterator => new SubtypesIterator(this);
+ Iterator<ClassEntity> get iterator => new SubtypesIterator(this);
}
/// Iterator for the subtypes in a [ClassSet].
-class SubtypesIterator extends Iterator<ClassElement> {
+class SubtypesIterator extends Iterator<ClassEntity> {
final SubtypesIterable iterable;
- Iterator<ClassElement> elements;
+ Iterator<ClassEntity> elements;
Iterator<ClassHierarchyNode> hierarchyNodes;
SubtypesIterator(this.iterable);
@@ -858,7 +856,7 @@ class SubtypesIterator extends Iterator<ClassElement> {
EnumSet<Instantiation> get mask => iterable.mask;
@override
- ClassElement get current {
+ ClassEntity get current {
if (elements != null) {
return elements.current;
}
@@ -907,4 +905,4 @@ enum IterationStep {
/// Visiting function used for the `forEachX` functions of [ClassHierarchyNode]
/// and [ClassSet]. The return value controls the continued iteration. If `null`
/// is returned, iteration continues to the end.
-typedef IterationStep ForEachFunction(ClassElement cls);
+typedef IterationStep ForEachFunction(ClassEntity cls);
« no previous file with comments | « no previous file | pkg/compiler/lib/src/world.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698