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

Side by Side Diff: pkg/analyzer/lib/src/generated/element.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, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.element; 8 library engine.element;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 LibraryElement library, bool includeThisClass) { 1077 LibraryElement library, bool includeThisClass) {
1078 HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>(); 1078 HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>();
1079 ClassElement currentElement = this; 1079 ClassElement currentElement = this;
1080 if (includeThisClass) { 1080 if (includeThisClass) {
1081 PropertyAccessorElement element = currentElement.getGetter(getterName); 1081 PropertyAccessorElement element = currentElement.getGetter(getterName);
1082 if (element != null && element.isAccessibleIn(library)) { 1082 if (element != null && element.isAccessibleIn(library)) {
1083 return element; 1083 return element;
1084 } 1084 }
1085 } 1085 }
1086 while (currentElement != null && visitedClasses.add(currentElement)) { 1086 while (currentElement != null && visitedClasses.add(currentElement)) {
1087 for (InterfaceType mixin in currentElement.mixins) { 1087 for (InterfaceType mixin in currentElement.mixins.reversed) {
1088 ClassElement mixinElement = mixin.element; 1088 ClassElement mixinElement = mixin.element;
1089 if (mixinElement != null) { 1089 if (mixinElement != null) {
1090 PropertyAccessorElement element = mixinElement.getGetter(getterName); 1090 PropertyAccessorElement element = mixinElement.getGetter(getterName);
1091 if (element != null && element.isAccessibleIn(library)) { 1091 if (element != null && element.isAccessibleIn(library)) {
1092 return element; 1092 return element;
1093 } 1093 }
1094 } 1094 }
1095 } 1095 }
1096 InterfaceType supertype = currentElement.supertype; 1096 InterfaceType supertype = currentElement.supertype;
1097 if (supertype == null) { 1097 if (supertype == null) {
(...skipping 12 matching lines...) Expand all
1110 bool includeThisClass) { 1110 bool includeThisClass) {
1111 HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>(); 1111 HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>();
1112 ClassElement currentElement = this; 1112 ClassElement currentElement = this;
1113 if (includeThisClass) { 1113 if (includeThisClass) {
1114 MethodElement element = currentElement.getMethod(methodName); 1114 MethodElement element = currentElement.getMethod(methodName);
1115 if (element != null && element.isAccessibleIn(library)) { 1115 if (element != null && element.isAccessibleIn(library)) {
1116 return element; 1116 return element;
1117 } 1117 }
1118 } 1118 }
1119 while (currentElement != null && visitedClasses.add(currentElement)) { 1119 while (currentElement != null && visitedClasses.add(currentElement)) {
1120 for (InterfaceType mixin in currentElement.mixins) { 1120 for (InterfaceType mixin in currentElement.mixins.reversed) {
1121 ClassElement mixinElement = mixin.element; 1121 ClassElement mixinElement = mixin.element;
1122 if (mixinElement != null) { 1122 if (mixinElement != null) {
1123 MethodElement element = mixinElement.getMethod(methodName); 1123 MethodElement element = mixinElement.getMethod(methodName);
1124 if (element != null && element.isAccessibleIn(library)) { 1124 if (element != null && element.isAccessibleIn(library)) {
1125 return element; 1125 return element;
1126 } 1126 }
1127 } 1127 }
1128 } 1128 }
1129 InterfaceType supertype = currentElement.supertype; 1129 InterfaceType supertype = currentElement.supertype;
1130 if (supertype == null) { 1130 if (supertype == null) {
(...skipping 12 matching lines...) Expand all
1143 LibraryElement library, bool includeThisClass) { 1143 LibraryElement library, bool includeThisClass) {
1144 HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>(); 1144 HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>();
1145 ClassElement currentElement = this; 1145 ClassElement currentElement = this;
1146 if (includeThisClass) { 1146 if (includeThisClass) {
1147 PropertyAccessorElement element = currentElement.getSetter(setterName); 1147 PropertyAccessorElement element = currentElement.getSetter(setterName);
1148 if (element != null && element.isAccessibleIn(library)) { 1148 if (element != null && element.isAccessibleIn(library)) {
1149 return element; 1149 return element;
1150 } 1150 }
1151 } 1151 }
1152 while (currentElement != null && visitedClasses.add(currentElement)) { 1152 while (currentElement != null && visitedClasses.add(currentElement)) {
1153 for (InterfaceType mixin in currentElement.mixins) { 1153 for (InterfaceType mixin in currentElement.mixins.reversed) {
1154 ClassElement mixinElement = mixin.element; 1154 ClassElement mixinElement = mixin.element;
1155 if (mixinElement != null) { 1155 if (mixinElement != null) {
1156 PropertyAccessorElement element = mixinElement.getSetter(setterName); 1156 PropertyAccessorElement element = mixinElement.getSetter(setterName);
1157 if (element != null && element.isAccessibleIn(library)) { 1157 if (element != null && element.isAccessibleIn(library)) {
1158 return element; 1158 return element;
1159 } 1159 }
1160 } 1160 }
1161 } 1161 }
1162 InterfaceType supertype = currentElement.supertype; 1162 InterfaceType supertype = currentElement.supertype;
1163 if (supertype == null) { 1163 if (supertype == null) {
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
1790 1790
1791 @override 1791 @override
1792 accept(ElementVisitor visitor) => visitor.visitConstructorElement(this); 1792 accept(ElementVisitor visitor) => visitor.visitConstructorElement(this);
1793 1793
1794 @override 1794 @override
1795 void appendTo(StringBuffer buffer) { 1795 void appendTo(StringBuffer buffer) {
1796 if (enclosingElement == null) { 1796 if (enclosingElement == null) {
1797 String message; 1797 String message;
1798 String name = displayName; 1798 String name = displayName;
1799 if (name != null && !name.isEmpty) { 1799 if (name != null && !name.isEmpty) {
1800 message = 'Found constructor element named $name with no enclosing eleme nt'; 1800 message =
1801 'Found constructor element named $name with no enclosing element';
1801 } else { 1802 } else {
1802 message = 'Found unnamed constructor element with no enclosing element'; 1803 message = 'Found unnamed constructor element with no enclosing element';
1803 } 1804 }
1804 AnalysisEngine.instance.logger.logError(message); 1805 AnalysisEngine.instance.logger.logError(message);
1805 buffer.write('<unknown class>'); 1806 buffer.write('<unknown class>');
1806 } else { 1807 } else {
1807 buffer.write(enclosingElement.displayName); 1808 buffer.write(enclosingElement.displayName);
1808 } 1809 }
1809 String name = displayName; 1810 String name = displayName;
1810 if (name != null && !name.isEmpty) { 1811 if (name != null && !name.isEmpty) {
(...skipping 4810 matching lines...) Expand 10 before | Expand all | Expand 10 after
6621 PropertyAccessorElement element = getGetter(getterName); 6622 PropertyAccessorElement element = getGetter(getterName);
6622 if (element != null && element.isAccessibleIn(library)) { 6623 if (element != null && element.isAccessibleIn(library)) {
6623 return element; 6624 return element;
6624 } 6625 }
6625 return lookUpGetterInSuperclass(getterName, library); 6626 return lookUpGetterInSuperclass(getterName, library);
6626 } 6627 }
6627 6628
6628 @override 6629 @override
6629 PropertyAccessorElement lookUpGetterInSuperclass(String getterName, 6630 PropertyAccessorElement lookUpGetterInSuperclass(String getterName,
6630 LibraryElement library) { 6631 LibraryElement library) {
6631 for (InterfaceType mixin in mixins) { 6632 for (InterfaceType mixin in mixins.reversed) {
6632 PropertyAccessorElement element = mixin.getGetter(getterName); 6633 PropertyAccessorElement element = mixin.getGetter(getterName);
6633 if (element != null && element.isAccessibleIn(library)) { 6634 if (element != null && element.isAccessibleIn(library)) {
6634 return element; 6635 return element;
6635 } 6636 }
6636 } 6637 }
6637 HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>(); 6638 HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>();
6638 InterfaceType supertype = superclass; 6639 InterfaceType supertype = superclass;
6639 ClassElement supertypeElement = 6640 ClassElement supertypeElement =
6640 supertype == null ? null : supertype.element; 6641 supertype == null ? null : supertype.element;
6641 while (supertype != null && !visitedClasses.contains(supertypeElement)) { 6642 while (supertype != null && !visitedClasses.contains(supertypeElement)) {
6642 visitedClasses.add(supertypeElement); 6643 visitedClasses.add(supertypeElement);
6643 PropertyAccessorElement element = supertype.getGetter(getterName); 6644 PropertyAccessorElement element = supertype.getGetter(getterName);
6644 if (element != null && element.isAccessibleIn(library)) { 6645 if (element != null && element.isAccessibleIn(library)) {
6645 return element; 6646 return element;
6646 } 6647 }
6647 for (InterfaceType mixin in supertype.mixins) { 6648 for (InterfaceType mixin in supertype.mixins.reversed) {
6648 element = mixin.getGetter(getterName); 6649 element = mixin.getGetter(getterName);
6649 if (element != null && element.isAccessibleIn(library)) { 6650 if (element != null && element.isAccessibleIn(library)) {
6650 return element; 6651 return element;
6651 } 6652 }
6652 } 6653 }
6653 supertype = supertype.superclass; 6654 supertype = supertype.superclass;
6654 supertypeElement = supertype == null ? null : supertype.element; 6655 supertypeElement = supertype == null ? null : supertype.element;
6655 } 6656 }
6656 return null; 6657 return null;
6657 } 6658 }
6658 6659
6659 @override 6660 @override
6660 MethodElement lookUpMethod(String methodName, LibraryElement library) { 6661 MethodElement lookUpMethod(String methodName, LibraryElement library) {
6661 MethodElement element = getMethod(methodName); 6662 MethodElement element = getMethod(methodName);
6662 if (element != null && element.isAccessibleIn(library)) { 6663 if (element != null && element.isAccessibleIn(library)) {
6663 return element; 6664 return element;
6664 } 6665 }
6665 return lookUpMethodInSuperclass(methodName, library); 6666 return lookUpMethodInSuperclass(methodName, library);
6666 } 6667 }
6667 6668
6668 @override 6669 @override
6669 MethodElement lookUpMethodInSuperclass(String methodName, 6670 MethodElement lookUpMethodInSuperclass(String methodName,
6670 LibraryElement library) { 6671 LibraryElement library) {
6671 for (InterfaceType mixin in mixins) { 6672 for (InterfaceType mixin in mixins.reversed) {
6672 MethodElement element = mixin.getMethod(methodName); 6673 MethodElement element = mixin.getMethod(methodName);
6673 if (element != null && element.isAccessibleIn(library)) { 6674 if (element != null && element.isAccessibleIn(library)) {
6674 return element; 6675 return element;
6675 } 6676 }
6676 } 6677 }
6677 HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>(); 6678 HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>();
6678 InterfaceType supertype = superclass; 6679 InterfaceType supertype = superclass;
6679 ClassElement supertypeElement = 6680 ClassElement supertypeElement =
6680 supertype == null ? null : supertype.element; 6681 supertype == null ? null : supertype.element;
6681 while (supertype != null && !visitedClasses.contains(supertypeElement)) { 6682 while (supertype != null && !visitedClasses.contains(supertypeElement)) {
6682 visitedClasses.add(supertypeElement); 6683 visitedClasses.add(supertypeElement);
6683 MethodElement element = supertype.getMethod(methodName); 6684 MethodElement element = supertype.getMethod(methodName);
6684 if (element != null && element.isAccessibleIn(library)) { 6685 if (element != null && element.isAccessibleIn(library)) {
6685 return element; 6686 return element;
6686 } 6687 }
6687 for (InterfaceType mixin in supertype.mixins) { 6688 for (InterfaceType mixin in supertype.mixins.reversed) {
6688 element = mixin.getMethod(methodName); 6689 element = mixin.getMethod(methodName);
6689 if (element != null && element.isAccessibleIn(library)) { 6690 if (element != null && element.isAccessibleIn(library)) {
6690 return element; 6691 return element;
6691 } 6692 }
6692 } 6693 }
6693 supertype = supertype.superclass; 6694 supertype = supertype.superclass;
6694 supertypeElement = supertype == null ? null : supertype.element; 6695 supertypeElement = supertype == null ? null : supertype.element;
6695 } 6696 }
6696 return null; 6697 return null;
6697 } 6698 }
6698 6699
6699 @override 6700 @override
6700 PropertyAccessorElement lookUpSetter(String setterName, 6701 PropertyAccessorElement lookUpSetter(String setterName,
6701 LibraryElement library) { 6702 LibraryElement library) {
6702 PropertyAccessorElement element = getSetter(setterName); 6703 PropertyAccessorElement element = getSetter(setterName);
6703 if (element != null && element.isAccessibleIn(library)) { 6704 if (element != null && element.isAccessibleIn(library)) {
6704 return element; 6705 return element;
6705 } 6706 }
6706 return lookUpSetterInSuperclass(setterName, library); 6707 return lookUpSetterInSuperclass(setterName, library);
6707 } 6708 }
6708 6709
6709 @override 6710 @override
6710 PropertyAccessorElement lookUpSetterInSuperclass(String setterName, 6711 PropertyAccessorElement lookUpSetterInSuperclass(String setterName,
6711 LibraryElement library) { 6712 LibraryElement library) {
6712 for (InterfaceType mixin in mixins) { 6713 for (InterfaceType mixin in mixins.reversed) {
6713 PropertyAccessorElement element = mixin.getSetter(setterName); 6714 PropertyAccessorElement element = mixin.getSetter(setterName);
6714 if (element != null && element.isAccessibleIn(library)) { 6715 if (element != null && element.isAccessibleIn(library)) {
6715 return element; 6716 return element;
6716 } 6717 }
6717 } 6718 }
6718 HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>(); 6719 HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>();
6719 InterfaceType supertype = superclass; 6720 InterfaceType supertype = superclass;
6720 ClassElement supertypeElement = 6721 ClassElement supertypeElement =
6721 supertype == null ? null : supertype.element; 6722 supertype == null ? null : supertype.element;
6722 while (supertype != null && !visitedClasses.contains(supertypeElement)) { 6723 while (supertype != null && !visitedClasses.contains(supertypeElement)) {
6723 visitedClasses.add(supertypeElement); 6724 visitedClasses.add(supertypeElement);
6724 PropertyAccessorElement element = supertype.getSetter(setterName); 6725 PropertyAccessorElement element = supertype.getSetter(setterName);
6725 if (element != null && element.isAccessibleIn(library)) { 6726 if (element != null && element.isAccessibleIn(library)) {
6726 return element; 6727 return element;
6727 } 6728 }
6728 for (InterfaceType mixin in supertype.mixins) { 6729 for (InterfaceType mixin in supertype.mixins.reversed) {
6729 element = mixin.getSetter(setterName); 6730 element = mixin.getSetter(setterName);
6730 if (element != null && element.isAccessibleIn(library)) { 6731 if (element != null && element.isAccessibleIn(library)) {
6731 return element; 6732 return element;
6732 } 6733 }
6733 } 6734 }
6734 supertype = supertype.superclass; 6735 supertype = supertype.superclass;
6735 supertypeElement = supertype == null ? null : supertype.element; 6736 supertypeElement = supertype == null ? null : supertype.element;
6736 } 6737 }
6737 return null; 6738 return null;
6738 } 6739 }
(...skipping 4374 matching lines...) Expand 10 before | Expand all | Expand 10 after
11113 // bottom <: void (as bottom is a subtype of all types). 11114 // bottom <: void (as bottom is a subtype of all types).
11114 // void <: dynamic (as dynamic is a supertype of all types) 11115 // void <: dynamic (as dynamic is a supertype of all types)
11115 return identical(type, this) || type.isDynamic; 11116 return identical(type, this) || type.isDynamic;
11116 } 11117 }
11117 11118
11118 @override 11119 @override
11119 VoidTypeImpl substitute2(List<DartType> argumentTypes, 11120 VoidTypeImpl substitute2(List<DartType> argumentTypes,
11120 List<DartType> parameterTypes) => 11121 List<DartType> parameterTypes) =>
11121 this; 11122 this;
11122 } 11123 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698