| 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 services.src.index.index_contributor; | 8 library services.src.index.index_contributor; |
| 9 | 9 |
| 10 import 'dart:collection' show Queue; | 10 import 'dart:collection' show Queue; |
| (...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1068 * | 1068 * |
| 1069 * [identifier] - the identifier to record location. | 1069 * [identifier] - the identifier to record location. |
| 1070 * [element] - the [Element] of the identifier. | 1070 * [element] - the [Element] of the identifier. |
| 1071 * [location] - the raw location | 1071 * [location] - the raw location |
| 1072 * | 1072 * |
| 1073 * Returns the [Location] with the type of the assigned value | 1073 * Returns the [Location] with the type of the assigned value |
| 1074 */ | 1074 */ |
| 1075 static Location | 1075 static Location |
| 1076 _getLocationWithTypeAssignedToField(SimpleIdentifier identifier, | 1076 _getLocationWithTypeAssignedToField(SimpleIdentifier identifier, |
| 1077 Element element, Location location) { | 1077 Element element, Location location) { |
| 1078 // TODO(scheglov) decide if we want to remember assigned types |
| 1078 // we need accessor | 1079 // we need accessor |
| 1079 if (element is! PropertyAccessorElement) { | 1080 if (element is! PropertyAccessorElement) { |
| 1080 return location; | 1081 return location; |
| 1081 } | 1082 } |
| 1082 PropertyAccessorElement accessor = element as PropertyAccessorElement; | 1083 PropertyAccessorElement accessor = element as PropertyAccessorElement; |
| 1083 // should be setter | 1084 // should be setter |
| 1084 if (!accessor.isSetter) { | 1085 if (!accessor.isSetter) { |
| 1085 return location; | 1086 return location; |
| 1086 } | 1087 } |
| 1087 // accessor should be synthetic, i.e. field normal | 1088 // accessor should be synthetic, i.e. field normal |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1174 if (candidates.length == 1) { | 1175 if (candidates.length == 1) { |
| 1175 return candidates[0]; | 1176 return candidates[0]; |
| 1176 } | 1177 } |
| 1177 // ensure that each ImportElement has set of elements | 1178 // ensure that each ImportElement has set of elements |
| 1178 for (ImportElement importElement in candidates) { | 1179 for (ImportElement importElement in candidates) { |
| 1179 if (importElementsMap.containsKey(importElement)) { | 1180 if (importElementsMap.containsKey(importElement)) { |
| 1180 continue; | 1181 continue; |
| 1181 } | 1182 } |
| 1182 Namespace namespace = new NamespaceBuilder( | 1183 Namespace namespace = new NamespaceBuilder( |
| 1183 ).createImportNamespaceForDirective(importElement); | 1184 ).createImportNamespaceForDirective(importElement); |
| 1184 Set<Element> elements = new Set(); | 1185 Set<Element> elements = new Set.from(namespace.definedNames.values); |
| 1185 importElementsMap[importElement] = elements; | 1186 importElementsMap[importElement] = elements; |
| 1186 } | 1187 } |
| 1187 // use import namespace to choose correct one | 1188 // use import namespace to choose correct one |
| 1188 for (MapEntry<ImportElement, Set<Element>> entry in getMapEntrySet( | 1189 for (MapEntry<ImportElement, Set<Element>> entry in getMapEntrySet( |
| 1189 importElementsMap)) { | 1190 importElementsMap)) { |
| 1190 if (entry.getValue().contains(usedElement)) { | 1191 if (entry.getValue().contains(usedElement)) { |
| 1191 return entry.getKey(); | 1192 return entry.getKey(); |
| 1192 } | 1193 } |
| 1193 } | 1194 } |
| 1194 // not found | 1195 // not found |
| 1195 return null; | 1196 return null; |
| 1196 } | 1197 } |
| 1197 | 1198 |
| 1198 /** | 1199 /** |
| 1199 * @return `true` if given "node" is part of an import [Combinator]. | 1200 * @return `true` if given "node" is part of an import [Combinator]. |
| 1200 */ | 1201 */ |
| 1201 static bool _isIdentifierInImportCombinator(SimpleIdentifier node) { | 1202 static bool _isIdentifierInImportCombinator(SimpleIdentifier node) { |
| 1202 AstNode parent = node.parent; | 1203 AstNode parent = node.parent; |
| 1203 return parent is Combinator; | 1204 return parent is Combinator; |
| 1204 } | 1205 } |
| 1205 | 1206 |
| 1206 /** | 1207 /** |
| 1207 * @return `true` if given "node" is part of [PrefixedIdentifier] "prefix.node
". | 1208 * @return `true` if given "node" is part of [PrefixedIdentifier] "prefix.node
". |
| 1208 */ | 1209 */ |
| 1209 static bool _isIdentifierInPrefixedIdentifier(SimpleIdentifier node) { | 1210 static bool _isIdentifierInPrefixedIdentifier(SimpleIdentifier node) { |
| 1210 AstNode parent = node.parent; | 1211 AstNode parent = node.parent; |
| 1211 return parent is PrefixedIdentifier && identical(parent.identifier, node); | 1212 return parent is PrefixedIdentifier && identical(parent.identifier, node); |
| 1212 } | 1213 } |
| 1213 } | 1214 } |
| OLD | NEW |