Index: pkg/compiler/lib/src/js_emitter/sorter.dart |
diff --git a/pkg/compiler/lib/src/js_emitter/sorter.dart b/pkg/compiler/lib/src/js_emitter/sorter.dart |
index 0443577cf3a56f9d87d910274786174b612a0bba..3b99320bd1a725a81b6a6975d056558f12bcbfbf 100644 |
--- a/pkg/compiler/lib/src/js_emitter/sorter.dart |
+++ b/pkg/compiler/lib/src/js_emitter/sorter.dart |
@@ -32,7 +32,24 @@ class ElementSorter implements Sorter { |
@override |
List<ClassEntity> sortClasses(Iterable<ClassEntity> classes) { |
- return Elements.sortedByPosition(new List.from(classes, growable: false)); |
+ List<ClassElement> regularClasses = <ClassElement>[]; |
+ List<MixinApplicationElement> unnamedMixins = <MixinApplicationElement>[]; |
+ for (ClassElement cls in classes) { |
+ if (cls.isUnnamedMixinApplication) { |
+ unnamedMixins.add(cls); |
+ } else { |
+ regularClasses.add(cls); |
+ } |
+ } |
+ List<ClassEntity> sorted = <ClassEntity>[]; |
+ sorted.addAll(Elements.sortedByPosition<ClassElement>(regularClasses)); |
+ unnamedMixins.sort((a, b) { |
+ int result = a.name.compareTo(b.name); |
+ if (result != 0) return result; |
+ return Elements.compareByPosition(a.mixin, b.mixin); |
+ }); |
+ sorted.addAll(unnamedMixins); |
+ return sorted; |
} |
@override |