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

Unified Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 879093002: Fix mixin resolution order when multiple mixins present. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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/analyzer/lib/src/generated/element_resolver.dart ('k') | pkg/analyzer/test/generated/element_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/resolver.dart
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index ae4bdedc002835ae42e503e31d919828ce1e07b7..0576ed003700018153bfa5afe32eace3d6dd7b8b 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -5960,11 +5960,13 @@ class InheritanceManager {
}
}
//
- // Include the members from the mixins in the resultMap
+ // Include the members from the mixins in the resultMap. If there are
+ // multiple mixins, visit them in the order listed so that methods in later
+ // mixins will overwrite identically-named methods in earlier mixins.
//
List<InterfaceType> mixins = classElt.mixins;
- for (int i = mixins.length - 1; i >= 0; i--) {
- ClassElement mixinElement = mixins[i].element;
+ for (InterfaceType mixin in mixins) {
+ ClassElement mixinElement = mixin.element;
if (mixinElement != null) {
if (!visitedClasses.contains(mixinElement)) {
visitedClasses.add(mixinElement);
@@ -5974,11 +5976,11 @@ class InheritanceManager {
//
// Substitute the super types down the hierarchy.
//
- _substituteTypeParametersDownHierarchy(mixins[i], map);
+ _substituteTypeParametersDownHierarchy(mixin, map);
//
// Include the members from the superclass in the resultMap.
//
- _recordMapWithClassMembers(map, mixins[i], false);
+ _recordMapWithClassMembers(map, mixin, false);
//
// Add the members from map into result map.
//
« no previous file with comments | « pkg/analyzer/lib/src/generated/element_resolver.dart ('k') | pkg/analyzer/test/generated/element_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698