Index: pkg/kernel/lib/transformations/insert_covariance_checks.dart |
diff --git a/pkg/kernel/lib/transformations/insert_covariance_checks.dart b/pkg/kernel/lib/transformations/insert_covariance_checks.dart |
index 4367dd846fa3e8db5dabca82db2a4d2448c62894..a536697d710bec9c99c49636b73b6417267bfa3c 100644 |
--- a/pkg/kernel/lib/transformations/insert_covariance_checks.dart |
+++ b/pkg/kernel/lib/transformations/insert_covariance_checks.dart |
@@ -76,7 +76,11 @@ class InsertCovarianceChecks { |
types = new TypeEnvironment(coreTypes, hierarchy); |
// We transform every class before their subtypes. |
// This ensures that transitive overrides are taken into account. |
- hierarchy.classes.forEach(transformClass); |
+ var unorderedClasses = program.libraries |
+ .map((library) => library.classes) |
+ .expand((classes) => classes); |
+ var ordered = hierarchy.getOrderedClasses(unorderedClasses); |
+ ordered.forEach(transformClass); |
program.accept(new _CallTransformer(this)); |
} |