| 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.search_engine; | 5 library services.search_engine; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/dart/element/visitor.dart'; | 10 import 'package:analyzer/dart/element/visitor.dart'; |
| 11 import 'package:analyzer/src/dart/element/element.dart'; | 11 import 'package:analyzer/src/dart/element/element.dart'; |
| 12 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext; | 12 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext; |
| 13 import 'package:analyzer/src/generated/java_core.dart'; | |
| 14 import 'package:analyzer/src/generated/source.dart'; | 13 import 'package:analyzer/src/generated/source.dart'; |
| 14 import 'package:analyzer/src/generated/utilities_general.dart'; |
| 15 | 15 |
| 16 /** | 16 /** |
| 17 * Instances of the enum [MatchKind] represent the kind of reference that was | 17 * Instances of the enum [MatchKind] represent the kind of reference that was |
| 18 * found when a match represents a reference to an element. | 18 * found when a match represents a reference to an element. |
| 19 */ | 19 */ |
| 20 class MatchKind { | 20 class MatchKind { |
| 21 /** | 21 /** |
| 22 * A declaration of an element. | 22 * A declaration of an element. |
| 23 */ | 23 */ |
| 24 static const MatchKind DECLARATION = const MatchKind('DECLARATION'); | 24 static const MatchKind DECLARATION = const MatchKind('DECLARATION'); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 } | 168 } |
| 169 return _element; | 169 return _element; |
| 170 } | 170 } |
| 171 | 171 |
| 172 /** | 172 /** |
| 173 * The absolute path of the file containing the match. | 173 * The absolute path of the file containing the match. |
| 174 */ | 174 */ |
| 175 String get file => unitSource.fullName; | 175 String get file => unitSource.fullName; |
| 176 | 176 |
| 177 @override | 177 @override |
| 178 int get hashCode => | 178 int get hashCode { |
| 179 JavaArrays.makeHashCode([libraryUri, unitUri, kind, sourceRange]); | 179 return JenkinsSmiHash.hash4(libraryUri, unitUri, kind, sourceRange); |
| 180 } |
| 180 | 181 |
| 181 /** | 182 /** |
| 182 * Return the [LibraryElement] for the [libraryUri] in the [context]. | 183 * Return the [LibraryElement] for the [libraryUri] in the [context]. |
| 183 */ | 184 */ |
| 184 LibraryElement get libraryElement { | 185 LibraryElement get libraryElement { |
| 185 _libraryElement ??= context.getLibraryElement(librarySource); | 186 _libraryElement ??= context.getLibraryElement(librarySource); |
| 186 return _libraryElement; | 187 return _libraryElement; |
| 187 } | 188 } |
| 188 | 189 |
| 189 /** | 190 /** |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 if (element is ElementImpl) { | 252 if (element is ElementImpl) { |
| 252 if (element.codeOffset != null && | 253 if (element.codeOffset != null && |
| 253 element.codeOffset <= offset && | 254 element.codeOffset <= offset && |
| 254 offset <= element.codeOffset + element.codeLength) { | 255 offset <= element.codeOffset + element.codeLength) { |
| 255 containingElement = element; | 256 containingElement = element; |
| 256 super.visitElement(element); | 257 super.visitElement(element); |
| 257 } | 258 } |
| 258 } | 259 } |
| 259 } | 260 } |
| 260 } | 261 } |
| OLD | NEW |