| OLD | NEW |
| 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.resolver; | 8 library engine.resolver; |
| 9 | 9 |
| 10 import 'dart:collection'; | 10 import 'dart:collection'; |
| (...skipping 7990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8001 visitedClasses.add(superclassElt); | 8001 visitedClasses.add(superclassElt); |
| 8002 try { | 8002 try { |
| 8003 resultMap = new MemberMap.con2(computeClassChainLookupMap(superclassEl
t, visitedClasses)); | 8003 resultMap = new MemberMap.con2(computeClassChainLookupMap(superclassEl
t, visitedClasses)); |
| 8004 // | 8004 // |
| 8005 // Substitute the super types down the hierarchy. | 8005 // Substitute the super types down the hierarchy. |
| 8006 // | 8006 // |
| 8007 substituteTypeParametersDownHierarchy(supertype, resultMap); | 8007 substituteTypeParametersDownHierarchy(supertype, resultMap); |
| 8008 // | 8008 // |
| 8009 // Include the members from the superclass in the resultMap. | 8009 // Include the members from the superclass in the resultMap. |
| 8010 // | 8010 // |
| 8011 recordMapWithClassMembers(resultMap, supertype); | 8011 recordMapWithClassMembers(resultMap, supertype, false); |
| 8012 } finally { | 8012 } finally { |
| 8013 visitedClasses.remove(superclassElt); | 8013 visitedClasses.remove(superclassElt); |
| 8014 } | 8014 } |
| 8015 } else { | 8015 } else { |
| 8016 // This case happens only when the superclass was previously visited and
not in the lookup, | 8016 // This case happens only when the superclass was previously visited and
not in the lookup, |
| 8017 // meaning this is meant to shorten the compute for recursive cases. | 8017 // meaning this is meant to shorten the compute for recursive cases. |
| 8018 _classLookup[superclassElt] = resultMap; | 8018 _classLookup[superclassElt] = resultMap; |
| 8019 return resultMap; | 8019 return resultMap; |
| 8020 } | 8020 } |
| 8021 } | 8021 } |
| 8022 // | 8022 // |
| 8023 // Include the members from the mixins in the resultMap | 8023 // Include the members from the mixins in the resultMap |
| 8024 // | 8024 // |
| 8025 List<InterfaceType> mixins = classElt.mixins; | 8025 List<InterfaceType> mixins = classElt.mixins; |
| 8026 for (int i = mixins.length - 1; i >= 0; i--) { | 8026 for (int i = mixins.length - 1; i >= 0; i--) { |
| 8027 ClassElement mixinElement = mixins[i].element; | 8027 ClassElement mixinElement = mixins[i].element; |
| 8028 if (mixinElement != null) { | 8028 if (mixinElement != null) { |
| 8029 if (!visitedClasses.contains(mixinElement)) { | 8029 if (!visitedClasses.contains(mixinElement)) { |
| 8030 visitedClasses.add(mixinElement); | 8030 visitedClasses.add(mixinElement); |
| 8031 try { | 8031 try { |
| 8032 MemberMap map = new MemberMap.con2(computeClassChainLookupMap(mixinE
lement, visitedClasses)); | 8032 MemberMap map = new MemberMap.con2(computeClassChainLookupMap(mixinE
lement, visitedClasses)); |
| 8033 // | 8033 // |
| 8034 // Substitute the super types down the hierarchy. | 8034 // Substitute the super types down the hierarchy. |
| 8035 // | 8035 // |
| 8036 substituteTypeParametersDownHierarchy(mixins[i], map); | 8036 substituteTypeParametersDownHierarchy(mixins[i], map); |
| 8037 // | 8037 // |
| 8038 // Include the members from the superclass in the resultMap. | 8038 // Include the members from the superclass in the resultMap. |
| 8039 // | 8039 // |
| 8040 recordMapWithClassMembersFromMixin(map, mixins[i]); | 8040 recordMapWithClassMembers(map, mixins[i], false); |
| 8041 // | 8041 // |
| 8042 // Add the members from map into result map. | 8042 // Add the members from map into result map. |
| 8043 // | 8043 // |
| 8044 for (int j = 0; j < map.size; j++) { | 8044 for (int j = 0; j < map.size; j++) { |
| 8045 String key = map.getKey(j); | 8045 String key = map.getKey(j); |
| 8046 ExecutableElement value = map.getValue(j); | 8046 ExecutableElement value = map.getValue(j); |
| 8047 if (key != null) { | 8047 if (key != null) { |
| 8048 if (resultMap.get(key) == null || (resultMap.get(key) != null &&
!isAbstract(value))) { | 8048 if (resultMap.get(key) == null || (resultMap.get(key) != null &&
!isAbstract(value))) { |
| 8049 resultMap.put(key, value); | 8049 resultMap.put(key, value); |
| 8050 } | 8050 } |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8161 // | 8161 // |
| 8162 MemberMap map = computeInterfaceLookupMap(superclassElement, visitedIn
terfaces); | 8162 MemberMap map = computeInterfaceLookupMap(superclassElement, visitedIn
terfaces); |
| 8163 map = new MemberMap.con2(map); | 8163 map = new MemberMap.con2(map); |
| 8164 // | 8164 // |
| 8165 // Substitute the super type down the hierarchy. | 8165 // Substitute the super type down the hierarchy. |
| 8166 // | 8166 // |
| 8167 substituteTypeParametersDownHierarchy(supertype, map); | 8167 substituteTypeParametersDownHierarchy(supertype, map); |
| 8168 // | 8168 // |
| 8169 // Add any members from the super type into the map as well. | 8169 // Add any members from the super type into the map as well. |
| 8170 // | 8170 // |
| 8171 recordMapWithClassMembers(map, supertype); | 8171 recordMapWithClassMembers(map, supertype, true); |
| 8172 lookupMaps.add(map); | 8172 lookupMaps.add(map); |
| 8173 } finally { | 8173 } finally { |
| 8174 visitedInterfaces.remove(superclassElement); | 8174 visitedInterfaces.remove(superclassElement); |
| 8175 } | 8175 } |
| 8176 } else { | 8176 } else { |
| 8177 MemberMap map = _interfaceLookup[classElt]; | 8177 MemberMap map = _interfaceLookup[classElt]; |
| 8178 if (map != null) { | 8178 if (map != null) { |
| 8179 lookupMaps.add(map); | 8179 lookupMaps.add(map); |
| 8180 } else { | 8180 } else { |
| 8181 _interfaceLookup[superclassElement] = resultMap; | 8181 _interfaceLookup[superclassElement] = resultMap; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 8198 // | 8198 // |
| 8199 MemberMap map = computeInterfaceLookupMap(mixinElement, visitedInter
faces); | 8199 MemberMap map = computeInterfaceLookupMap(mixinElement, visitedInter
faces); |
| 8200 map = new MemberMap.con2(map); | 8200 map = new MemberMap.con2(map); |
| 8201 // | 8201 // |
| 8202 // Substitute the mixin type down the hierarchy. | 8202 // Substitute the mixin type down the hierarchy. |
| 8203 // | 8203 // |
| 8204 substituteTypeParametersDownHierarchy(mixinType, map); | 8204 substituteTypeParametersDownHierarchy(mixinType, map); |
| 8205 // | 8205 // |
| 8206 // Add any members from the mixin type into the map as well. | 8206 // Add any members from the mixin type into the map as well. |
| 8207 // | 8207 // |
| 8208 recordMapWithClassMembers(map, mixinType); | 8208 recordMapWithClassMembers(map, mixinType, true); |
| 8209 lookupMaps.add(map); | 8209 lookupMaps.add(map); |
| 8210 } finally { | 8210 } finally { |
| 8211 visitedInterfaces.remove(mixinElement); | 8211 visitedInterfaces.remove(mixinElement); |
| 8212 } | 8212 } |
| 8213 } else { | 8213 } else { |
| 8214 MemberMap map = _interfaceLookup[classElt]; | 8214 MemberMap map = _interfaceLookup[classElt]; |
| 8215 if (map != null) { | 8215 if (map != null) { |
| 8216 lookupMaps.add(map); | 8216 lookupMaps.add(map); |
| 8217 } else { | 8217 } else { |
| 8218 _interfaceLookup[mixinElement] = resultMap; | 8218 _interfaceLookup[mixinElement] = resultMap; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 8235 // | 8235 // |
| 8236 MemberMap map = computeInterfaceLookupMap(interfaceElement, visitedI
nterfaces); | 8236 MemberMap map = computeInterfaceLookupMap(interfaceElement, visitedI
nterfaces); |
| 8237 map = new MemberMap.con2(map); | 8237 map = new MemberMap.con2(map); |
| 8238 // | 8238 // |
| 8239 // Substitute the supertypes down the hierarchy | 8239 // Substitute the supertypes down the hierarchy |
| 8240 // | 8240 // |
| 8241 substituteTypeParametersDownHierarchy(interfaceType, map); | 8241 substituteTypeParametersDownHierarchy(interfaceType, map); |
| 8242 // | 8242 // |
| 8243 // And add any members from the interface into the map as well. | 8243 // And add any members from the interface into the map as well. |
| 8244 // | 8244 // |
| 8245 recordMapWithClassMembers(map, interfaceType); | 8245 recordMapWithClassMembers(map, interfaceType, true); |
| 8246 lookupMaps.add(map); | 8246 lookupMaps.add(map); |
| 8247 } finally { | 8247 } finally { |
| 8248 visitedInterfaces.remove(interfaceElement); | 8248 visitedInterfaces.remove(interfaceElement); |
| 8249 } | 8249 } |
| 8250 } else { | 8250 } else { |
| 8251 MemberMap map = _interfaceLookup[classElt]; | 8251 MemberMap map = _interfaceLookup[classElt]; |
| 8252 if (map != null) { | 8252 if (map != null) { |
| 8253 lookupMaps.add(map); | 8253 lookupMaps.add(map); |
| 8254 } else { | 8254 } else { |
| 8255 _interfaceLookup[interfaceElement] = resultMap; | 8255 _interfaceLookup[interfaceElement] = resultMap; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8448 return null; | 8448 return null; |
| 8449 } | 8449 } |
| 8450 | 8450 |
| 8451 /** | 8451 /** |
| 8452 * Record the passed map with the set of all members (methods, getters and set
ters) in the type | 8452 * Record the passed map with the set of all members (methods, getters and set
ters) in the type |
| 8453 * into the passed map. | 8453 * into the passed map. |
| 8454 * | 8454 * |
| 8455 * @param map some non-`null` map to put the methods and accessors from the pa
ssed | 8455 * @param map some non-`null` map to put the methods and accessors from the pa
ssed |
| 8456 * [ClassElement] into | 8456 * [ClassElement] into |
| 8457 * @param type the type that will be recorded into the passed map | 8457 * @param type the type that will be recorded into the passed map |
| 8458 * @param doIncludeAbstract `true` if abstract members will be put into the ma
p |
| 8458 */ | 8459 */ |
| 8459 void recordMapWithClassMembers(MemberMap map, InterfaceType type) { | 8460 void recordMapWithClassMembers(MemberMap map, InterfaceType type, bool doInclu
deAbstract) { |
| 8460 List<MethodElement> methods = type.methods; | 8461 List<MethodElement> methods = type.methods; |
| 8461 for (MethodElement method in methods) { | 8462 for (MethodElement method in methods) { |
| 8462 if (method.isAccessibleIn(_library) && !method.isStatic) { | 8463 if (method.isAccessibleIn(_library) && !method.isStatic && (doIncludeAbstr
act || !method.isAbstract)) { |
| 8463 map.put(method.name, method); | 8464 map.put(method.name, method); |
| 8464 } | 8465 } |
| 8465 } | 8466 } |
| 8466 List<PropertyAccessorElement> accessors = type.accessors; | 8467 List<PropertyAccessorElement> accessors = type.accessors; |
| 8467 for (PropertyAccessorElement accessor in accessors) { | 8468 for (PropertyAccessorElement accessor in accessors) { |
| 8468 if (accessor.isAccessibleIn(_library) && !accessor.isStatic) { | 8469 if (accessor.isAccessibleIn(_library) && !accessor.isStatic && (doIncludeA
bstract || !accessor.isAbstract)) { |
| 8469 map.put(accessor.name, accessor); | 8470 map.put(accessor.name, accessor); |
| 8470 } | 8471 } |
| 8471 } | 8472 } |
| 8472 } | 8473 } |
| 8473 | 8474 |
| 8474 /** | 8475 /** |
| 8475 * Similar to [recordMapWithClassMembers], but only puts values | |
| 8476 * into the map if the additional executable doesn't replace a concrete member
with an abstract | |
| 8477 * member, ex: NonErrorResolverTest.test_nonAbstractClassInheritsAbstractMembe
rOne_mixin_*() | |
| 8478 * | |
| 8479 * @param map some non-`null` map to put the methods and accessors from the pa
ssed | |
| 8480 * [ClassElement] into | |
| 8481 * @param type the type that will be recorded into the passed map | |
| 8482 */ | |
| 8483 void recordMapWithClassMembersFromMixin(MemberMap map, InterfaceType type) { | |
| 8484 List<MethodElement> methods = type.methods; | |
| 8485 for (MethodElement method in methods) { | |
| 8486 if (method.isAccessibleIn(_library) && !method.isStatic) { | |
| 8487 String methodName = method.name; | |
| 8488 ExecutableElement elementInMap = map.get(methodName); | |
| 8489 if (elementInMap == null || (elementInMap != null && !method.isAbstract)
) { | |
| 8490 map.put(methodName, method); | |
| 8491 } | |
| 8492 } | |
| 8493 } | |
| 8494 List<PropertyAccessorElement> accessors = type.accessors; | |
| 8495 for (PropertyAccessorElement accessor in accessors) { | |
| 8496 if (accessor.isAccessibleIn(_library) && !accessor.isStatic) { | |
| 8497 String accessorName = accessor.name; | |
| 8498 ExecutableElement elementInMap = map.get(accessorName); | |
| 8499 if (elementInMap == null || (elementInMap != null && !accessor.isAbstrac
t)) { | |
| 8500 map.put(accessorName, accessor); | |
| 8501 } | |
| 8502 } | |
| 8503 } | |
| 8504 } | |
| 8505 | |
| 8506 /** | |
| 8507 * This method is used to report errors on when they are found computing inher
itance information. | 8476 * This method is used to report errors on when they are found computing inher
itance information. |
| 8508 * See [ErrorVerifier#checkForInconsistentMethodInheritance] to see where thes
e generated | 8477 * See [ErrorVerifier#checkForInconsistentMethodInheritance] to see where thes
e generated |
| 8509 * error codes are reported back into the analysis engine. | 8478 * error codes are reported back into the analysis engine. |
| 8510 * | 8479 * |
| 8511 * @param classElt the location of the source for which the exception occurred | 8480 * @param classElt the location of the source for which the exception occurred |
| 8512 * @param offset the offset of the location of the error | 8481 * @param offset the offset of the location of the error |
| 8513 * @param length the length of the location of the error | 8482 * @param length the length of the location of the error |
| 8514 * @param errorCode the error code to be associated with this error | 8483 * @param errorCode the error code to be associated with this error |
| 8515 * @param arguments the arguments used to build the error message | 8484 * @param arguments the arguments used to build the error message |
| 8516 */ | 8485 */ |
| (...skipping 13228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21745 * @param correction the template used to create the correction to be displaye
d for the error | 21714 * @param correction the template used to create the correction to be displaye
d for the error |
| 21746 */ | 21715 */ |
| 21747 ResolverErrorCode.con2(String name, int ordinal, this.type, this.message, Stri
ng correction) : super(name, ordinal) { | 21716 ResolverErrorCode.con2(String name, int ordinal, this.type, this.message, Stri
ng correction) : super(name, ordinal) { |
| 21748 this.correction9 = correction; | 21717 this.correction9 = correction; |
| 21749 } | 21718 } |
| 21750 | 21719 |
| 21751 String get correction => correction9; | 21720 String get correction => correction9; |
| 21752 | 21721 |
| 21753 ErrorSeverity get errorSeverity => type.severity; | 21722 ErrorSeverity get errorSeverity => type.severity; |
| 21754 } | 21723 } |
| OLD | NEW |