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

Unified Diff: pkg/kernel/lib/class_hierarchy.dart

Issue 2924713002: Replace ClassHierarchy.classes with getOrderedClasses(). (Closed)
Patch Set: Created 3 years, 6 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/kernel/lib/class_hierarchy.dart
diff --git a/pkg/kernel/lib/class_hierarchy.dart b/pkg/kernel/lib/class_hierarchy.dart
index 34bf1277580f7850ec2fec6bacaf9d30a210d904..7fddd6394f152a6e5fa71629c876040e33e677bc 100644
--- a/pkg/kernel/lib/class_hierarchy.dart
+++ b/pkg/kernel/lib/class_hierarchy.dart
@@ -16,12 +16,14 @@ abstract class ClassHierarchy {
factory ClassHierarchy(Program program) =>
new ClosedWorldClassHierarchy(program);
- /// All classes in the program.
+ /// Given the [unordered] classes, return them in such order that classes
+ /// occur after their super classes.
///
- /// The iterable is ordered so that classes occur after their super classes.
- Iterable<Class> get classes;
+ /// If [unordered] does not include all superclasses, they might still be
+ /// returned, it is up to the client to filter them out if required.
+ Iterable<Class> getOrderedClasses(Iterable<Class> unordered);
- /// Returns the index of [class_] in the [classes] list.
+ /// Returns the unique index of the [class_].
int getClassIndex(Class class_);
/// True if the program contains another class that is a subtype of given one.
@@ -137,6 +139,9 @@ class ClosedWorldClassHierarchy implements ClassHierarchy {
@override
int getClassIndex(Class class_) => _infoFor[class_].topologicalIndex;
+ @override
+ Iterable<Class> getOrderedClasses(Iterable<Class> unordered) => classes;
+
/// True if [subclass] inherits from [superclass] though zero or more
/// `extends` relationships.
bool isSubclassOf(Class subclass, Class superclass) {

Powered by Google App Engine
This is Rietveld 408576698