| 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/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/element/element.dart'; | 8 import 'package:analyzer/dart/element/element.dart'; |
| 9 import 'package:analyzer/src/dart/resolver/scope.dart'; | 9 import 'package:analyzer/src/dart/resolver/scope.dart'; |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 /** | 39 /** |
| 40 * Returns the [ImportElement] that is referenced by [prefixNode] with | 40 * Returns the [ImportElement] that is referenced by [prefixNode] with |
| 41 * an [PrefixElement], maybe `null`. | 41 * an [PrefixElement], maybe `null`. |
| 42 */ | 42 */ |
| 43 ImportElement getImportElement(SimpleIdentifier prefixNode) { | 43 ImportElement getImportElement(SimpleIdentifier prefixNode) { |
| 44 if (prefixNode.parent is ImportDirective) { | 44 if (prefixNode.parent is ImportDirective) { |
| 45 ImportDirective importDirective = prefixNode.parent; | 45 ImportDirective importDirective = prefixNode.parent; |
| 46 return importDirective.element; | 46 return importDirective.element; |
| 47 } | 47 } |
| 48 ImportElementInfo info = internal_getImportElementInfo(prefixNode); | 48 ImportElementInfo info = internal_getImportElementInfo(prefixNode); |
| 49 return info != null ? info.element : null; | 49 return info?.element; |
| 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 */ |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 173 } |
| 174 | 174 |
| 175 /** | 175 /** |
| 176 * Information about [ImportElement] and place where it is referenced using | 176 * Information about [ImportElement] and place where it is referenced using |
| 177 * [PrefixElement]. | 177 * [PrefixElement]. |
| 178 */ | 178 */ |
| 179 class ImportElementInfo { | 179 class ImportElementInfo { |
| 180 ImportElement element; | 180 ImportElement element; |
| 181 int periodEnd; | 181 int periodEnd; |
| 182 } | 182 } |
| OLD | NEW |