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

Unified Diff: pkg/compiler/lib/src/js_emitter/sorter.dart

Issue 3005823002: Handle forwarding constructors to unnamed mixin applications (Closed)
Patch Set: Updated cf. comments Created 3 years, 3 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/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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/kernel/env.dart » ('j') | pkg/compiler/lib/src/kernel/kernel_backend_strategy.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698