| 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.refactoring.rename; | 5 library services.src.refactoring.rename; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/protocol_server.dart' hide Element; | 9 import 'package:analysis_server/src/protocol_server.dart' hide Element; |
| 10 import 'package:analysis_server/src/services/correction/source_range.dart'; | 10 import 'package:analysis_server/src/services/correction/source_range.dart'; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 List<Source> librarySourcesOfSource = context.getLibrariesContaining(source); | 50 List<Source> librarySourcesOfSource = context.getLibrariesContaining(source); |
| 51 Source librarySourceOfElement = element.library.source; | 51 Source librarySourceOfElement = element.library.source; |
| 52 return librarySourcesOfSource.contains(librarySourceOfElement); | 52 return librarySourcesOfSource.contains(librarySourceOfElement); |
| 53 } | 53 } |
| 54 | 54 |
| 55 | 55 |
| 56 /** | 56 /** |
| 57 * Checks if the given [Element] is in the given [AnalysisContext]. | 57 * Checks if the given [Element] is in the given [AnalysisContext]. |
| 58 */ | 58 */ |
| 59 bool isInContext(Element element, AnalysisContext context) { | 59 bool isInContext(Element element, AnalysisContext context) { |
| 60 AnalysisContext elementContext = element.context; | 60 return element.context == context; |
| 61 if (elementContext == context) { | |
| 62 return true; | |
| 63 } | |
| 64 if (context is InstrumentedAnalysisContextImpl) { | |
| 65 return elementContext == context.basis; | |
| 66 } | |
| 67 return false; | |
| 68 } | 61 } |
| 69 | 62 |
| 70 | 63 |
| 71 /** | 64 /** |
| 72 * Checks if the given unqualified [SearchMatch] intersects with visibility | 65 * Checks if the given unqualified [SearchMatch] intersects with visibility |
| 73 * range of [localElement]. | 66 * range of [localElement]. |
| 74 */ | 67 */ |
| 75 bool isReferenceInLocalRange(LocalElement localElement, SearchMatch reference) { | 68 bool isReferenceInLocalRange(LocalElement localElement, SearchMatch reference) { |
| 76 if (reference.isQualified) { | 69 if (reference.isQualified) { |
| 77 return false; | 70 return false; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 if (element is ImportElement) { | 176 if (element is ImportElement) { |
| 184 PrefixElement prefix = element.prefix; | 177 PrefixElement prefix = element.prefix; |
| 185 if (prefix != null) { | 178 if (prefix != null) { |
| 186 return prefix.displayName; | 179 return prefix.displayName; |
| 187 } | 180 } |
| 188 return ''; | 181 return ''; |
| 189 } | 182 } |
| 190 return element.displayName; | 183 return element.displayName; |
| 191 } | 184 } |
| 192 } | 185 } |
| OLD | NEW |