| 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 library engine.resolver; | 5 library engine.resolver; |
| 6 | 6 |
| 7 import "dart:math" as math; | 7 import "dart:math" as math; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/utilities_collection.dart'; | 10 import 'package:analyzer/src/generated/utilities_collection.dart'; |
| (...skipping 5942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5953 } | 5953 } |
| 5954 } else { | 5954 } else { |
| 5955 // This case happens only when the superclass was previously visited and | 5955 // This case happens only when the superclass was previously visited and |
| 5956 // not in the lookup, meaning this is meant to shorten the compute for | 5956 // not in the lookup, meaning this is meant to shorten the compute for |
| 5957 // recursive cases. | 5957 // recursive cases. |
| 5958 _classLookup[superclassElt] = resultMap; | 5958 _classLookup[superclassElt] = resultMap; |
| 5959 return resultMap; | 5959 return resultMap; |
| 5960 } | 5960 } |
| 5961 } | 5961 } |
| 5962 // | 5962 // |
| 5963 // Include the members from the mixins in the resultMap | 5963 // Include the members from the mixins in the resultMap. If there are |
| 5964 // multiple mixins, visit them in the order listed so that methods in later |
| 5965 // mixins will overwrite identically-named methods in earlier mixins. |
| 5964 // | 5966 // |
| 5965 List<InterfaceType> mixins = classElt.mixins; | 5967 List<InterfaceType> mixins = classElt.mixins; |
| 5966 for (int i = mixins.length - 1; i >= 0; i--) { | 5968 for (InterfaceType mixin in mixins) { |
| 5967 ClassElement mixinElement = mixins[i].element; | 5969 ClassElement mixinElement = mixin.element; |
| 5968 if (mixinElement != null) { | 5970 if (mixinElement != null) { |
| 5969 if (!visitedClasses.contains(mixinElement)) { | 5971 if (!visitedClasses.contains(mixinElement)) { |
| 5970 visitedClasses.add(mixinElement); | 5972 visitedClasses.add(mixinElement); |
| 5971 try { | 5973 try { |
| 5972 MemberMap map = | 5974 MemberMap map = |
| 5973 new MemberMap.con2(_computeClassChainLookupMap(mixinElement, vis
itedClasses)); | 5975 new MemberMap.con2(_computeClassChainLookupMap(mixinElement, vis
itedClasses)); |
| 5974 // | 5976 // |
| 5975 // Substitute the super types down the hierarchy. | 5977 // Substitute the super types down the hierarchy. |
| 5976 // | 5978 // |
| 5977 _substituteTypeParametersDownHierarchy(mixins[i], map); | 5979 _substituteTypeParametersDownHierarchy(mixin, map); |
| 5978 // | 5980 // |
| 5979 // Include the members from the superclass in the resultMap. | 5981 // Include the members from the superclass in the resultMap. |
| 5980 // | 5982 // |
| 5981 _recordMapWithClassMembers(map, mixins[i], false); | 5983 _recordMapWithClassMembers(map, mixin, false); |
| 5982 // | 5984 // |
| 5983 // Add the members from map into result map. | 5985 // Add the members from map into result map. |
| 5984 // | 5986 // |
| 5985 for (int j = 0; j < map.size; j++) { | 5987 for (int j = 0; j < map.size; j++) { |
| 5986 String key = map.getKey(j); | 5988 String key = map.getKey(j); |
| 5987 ExecutableElement value = map.getValue(j); | 5989 ExecutableElement value = map.getValue(j); |
| 5988 if (key != null) { | 5990 if (key != null) { |
| 5989 if (resultMap.get(key) == null || | 5991 if (resultMap.get(key) == null || |
| 5990 (resultMap.get(key) != null && !_isAbstract(value))) { | 5992 (resultMap.get(key) != null && !_isAbstract(value))) { |
| 5991 resultMap.put(key, value); | 5993 resultMap.put(key, value); |
| (...skipping 9466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15458 * library. | 15460 * library. |
| 15459 */ | 15461 */ |
| 15460 final HashSet<String> members = new HashSet<String>(); | 15462 final HashSet<String> members = new HashSet<String>(); |
| 15461 | 15463 |
| 15462 /** | 15464 /** |
| 15463 * Names of resolved or unresolved class members that are read in the | 15465 * Names of resolved or unresolved class members that are read in the |
| 15464 * library. | 15466 * library. |
| 15465 */ | 15467 */ |
| 15466 final HashSet<String> readMembers = new HashSet<String>(); | 15468 final HashSet<String> readMembers = new HashSet<String>(); |
| 15467 } | 15469 } |
| OLD | NEW |