| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 analysis_server.src.services.search.search_engine_internal; | 5 library analysis_server.src.services.search.search_engine_internal; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/services/correction/source_range.dart'; | 9 import 'package:analysis_server/src/services/correction/source_range.dart'; |
| 10 import 'package:analysis_server/src/services/index/index.dart'; | 10 import 'package:analysis_server/src/services/index/index.dart'; |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 AstNode enclosingNode = node?.getAncestor(isRootNode); | 254 AstNode enclosingNode = node?.getAncestor(isRootNode); |
| 255 enclosingNode?.accept(visitor); | 255 enclosingNode?.accept(visitor); |
| 256 return visitor.matches; | 256 return visitor.matches; |
| 257 } | 257 } |
| 258 | 258 |
| 259 Future<List<SearchMatch>> _searchReferences_Parameter( | 259 Future<List<SearchMatch>> _searchReferences_Parameter( |
| 260 ParameterElement parameter) async { | 260 ParameterElement parameter) async { |
| 261 List<SearchMatch> matches = <SearchMatch>[]; | 261 List<SearchMatch> matches = <SearchMatch>[]; |
| 262 matches.addAll(await _searchReferences(parameter)); | 262 matches.addAll(await _searchReferences(parameter)); |
| 263 matches.addAll(await _searchReferences_Local( | 263 matches.addAll(await _searchReferences_Local( |
| 264 parameter, (n) => n is MethodDeclaration || n is FunctionExpression)); | 264 parameter, |
| 265 (n) => |
| 266 n is ConstructorDeclaration || |
| 267 n is MethodDeclaration || |
| 268 n is FunctionExpression)); |
| 265 return matches; | 269 return matches; |
| 266 } | 270 } |
| 267 | 271 |
| 268 Future<List<SearchMatch>> _searchReferences_Prefix( | 272 Future<List<SearchMatch>> _searchReferences_Prefix( |
| 269 PrefixElement element) async { | 273 PrefixElement element) async { |
| 270 List<SearchMatch> matches = <SearchMatch>[]; | 274 List<SearchMatch> matches = <SearchMatch>[]; |
| 271 LibraryElement libraryElement = element.library; | 275 LibraryElement libraryElement = element.library; |
| 272 Source librarySource = libraryElement.source; | 276 Source librarySource = libraryElement.source; |
| 273 AnalysisContext context = libraryElement.context; | 277 AnalysisContext context = libraryElement.context; |
| 274 for (CompilationUnitElement unitElement in libraryElement.units) { | 278 for (CompilationUnitElement unitElement in libraryElement.units) { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 _addMatch(node, kind); | 405 _addMatch(node, kind); |
| 402 } | 406 } |
| 403 } | 407 } |
| 404 | 408 |
| 405 void _addMatch(AstNode node, MatchKind kind) { | 409 void _addMatch(AstNode node, MatchKind kind) { |
| 406 bool isQualified = node is SimpleIdentifier && node.isQualified; | 410 bool isQualified = node is SimpleIdentifier && node.isQualified; |
| 407 matches.add(new SearchMatch(context, libraryUri, unitUri, kind, | 411 matches.add(new SearchMatch(context, libraryUri, unitUri, kind, |
| 408 rangeNode(node), true, isQualified)); | 412 rangeNode(node), true, isQualified)); |
| 409 } | 413 } |
| 410 } | 414 } |
| OLD | NEW |