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

Unified Diff: pkg/compiler/lib/src/kernel/kernel_backend_strategy.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
« no previous file with comments | « pkg/compiler/lib/src/kernel/env.dart ('k') | pkg/compiler/lib/src/ssa/builder_kernel.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/kernel/kernel_backend_strategy.dart
diff --git a/pkg/compiler/lib/src/kernel/kernel_backend_strategy.dart b/pkg/compiler/lib/src/kernel/kernel_backend_strategy.dart
index 6cce8985ee24d1d55bed4ca1bcf33163ea45898c..ff5df10a44f0ce5b8e167d66305bb132aa071a33 100644
--- a/pkg/compiler/lib/src/kernel/kernel_backend_strategy.dart
+++ b/pkg/compiler/lib/src/kernel/kernel_backend_strategy.dart
@@ -233,15 +233,37 @@ class KernelSorter implements Sorter {
@override
Iterable<ClassEntity> sortClasses(Iterable<ClassEntity> classes) {
- return classes.toList()
- ..sort((ClassEntity cls1, ClassEntity cls2) {
- int r = _compareLibraries(cls1.library, cls2.library);
- if (r != 0) return r;
- ClassDefinition definition1 = elementMap.getClassDefinition(cls1);
- ClassDefinition definition2 = elementMap.getClassDefinition(cls2);
- return _compareSourceSpans(
- cls1, definition1.location, cls2, definition2.location);
- });
+ int compareClasses(ClassEntity cls1, ClassEntity cls2) {
+ int r = _compareLibraries(cls1.library, cls2.library);
+ if (r != 0) return r;
+ ClassDefinition definition1 = elementMap.getClassDefinition(cls1);
+ ClassDefinition definition2 = elementMap.getClassDefinition(cls2);
+ return _compareSourceSpans(
+ cls1, definition1.location, cls2, definition2.location);
+ }
+
+ List<ClassEntity> regularClasses = <ClassEntity>[];
+ List<ClassEntity> unnamedMixins = <ClassEntity>[];
+ for (ClassEntity cls in classes) {
+ if (elementMap.elementEnvironment.isUnnamedMixinApplication(cls)) {
+ unnamedMixins.add(cls);
+ } else {
+ regularClasses.add(cls);
+ }
+ }
+ List<ClassEntity> sorted = <ClassEntity>[];
+ regularClasses.sort(compareClasses);
+ sorted.addAll(regularClasses);
+ unnamedMixins.sort((a, b) {
+ int result = _compareLibraries(a.library, b.library);
+ if (result != 0) return result;
+ result = a.name.compareTo(b.name);
+ assert(result != 0,
+ failedAt(a, "Multiple mixins named ${a.name}: $a vs $b."));
Siggi Cherem (dart-lang) 2017/09/01 15:41:49 do we ensure today that if you do A extends Object
Johnni Winther 2017/09/01 16:13:48 We do in the optimized mixin algorithm (ported fro
+ return result;
+ });
+ sorted.addAll(unnamedMixins);
+ return sorted;
}
@override
« no previous file with comments | « pkg/compiler/lib/src/kernel/env.dart ('k') | pkg/compiler/lib/src/ssa/builder_kernel.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698