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 services.src.correction.namespace; | 5 library services.src.correction.namespace; |
6 | 6 |
7 import 'package:analyzer/src/generated/ast.dart'; | 7 import 'package:analyzer/src/generated/ast.dart'; |
8 import 'package:analyzer/src/generated/element.dart'; | 8 import 'package:analyzer/src/generated/element.dart'; |
9 import 'package:analyzer/src/generated/resolver.dart'; | 9 import 'package:analyzer/src/generated/resolver.dart'; |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 } | 50 } |
51 | 51 |
52 /** | 52 /** |
53 * Return the [ImportElement] that declared [prefix] and imports [element]. | 53 * Return the [ImportElement] that declared [prefix] and imports [element]. |
54 * | 54 * |
55 * [libraryElement] - the [LibraryElement] where reference is. | 55 * [libraryElement] - the [LibraryElement] where reference is. |
56 * [prefix] - the import prefix, maybe `null`. | 56 * [prefix] - the import prefix, maybe `null`. |
57 * [element] - the referenced element. | 57 * [element] - the referenced element. |
58 * [importElementsMap] - the cache of [Element]s imported by [ImportElement]s. | 58 * [importElementsMap] - the cache of [Element]s imported by [ImportElement]s. |
59 */ | 59 */ |
60 ImportElement internal_getImportElement(LibraryElement libraryElement, | 60 ImportElement internal_getImportElement( |
61 String prefix, Element element, | 61 LibraryElement libraryElement, |
| 62 String prefix, |
| 63 Element element, |
62 Map<ImportElement, Set<Element>> importElementsMap) { | 64 Map<ImportElement, Set<Element>> importElementsMap) { |
63 // validate Element | 65 // validate Element |
64 if (element == null) { | 66 if (element == null) { |
65 return null; | 67 return null; |
66 } | 68 } |
67 if (element.enclosingElement is! CompilationUnitElement) { | 69 if (element.enclosingElement is! CompilationUnitElement) { |
68 return null; | 70 return null; |
69 } | 71 } |
70 LibraryElement usedLibrary = element.library; | 72 LibraryElement usedLibrary = element.library; |
71 // find ImportElement that imports used library with used prefix | 73 // find ImportElement that imports used library with used prefix |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 } | 173 } |
172 | 174 |
173 /** | 175 /** |
174 * Information about [ImportElement] and place where it is referenced using | 176 * Information about [ImportElement] and place where it is referenced using |
175 * [PrefixElement]. | 177 * [PrefixElement]. |
176 */ | 178 */ |
177 class ImportElementInfo { | 179 class ImportElementInfo { |
178 ImportElement element; | 180 ImportElement element; |
179 int periodEnd; | 181 int periodEnd; |
180 } | 182 } |
OLD | NEW |