| 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 node = element.computeNode(); | 254 AstNode node = element.computeNode(); |
| 255 AstNode enclosingNode = node?.getAncestor(isRootNode); | 255 AstNode enclosingNode = node?.getAncestor(isRootNode); |
| 256 enclosingNode?.accept(visitor); | 256 enclosingNode?.accept(visitor); |
| 257 return visitor.matches; | 257 return visitor.matches; |
| 258 } | 258 } |
| 259 | 259 |
| 260 Future<List<SearchMatch>> _searchReferences_Parameter( | 260 Future<List<SearchMatch>> _searchReferences_Parameter( |
| 261 ParameterElement parameter) async { | 261 ParameterElement parameter) async { |
| 262 List<SearchMatch> matches = <SearchMatch>[]; | 262 List<SearchMatch> matches = <SearchMatch>[]; |
| 263 matches.addAll(await _searchReferences(parameter)); | 263 matches.addAll(await _searchReferences(parameter)); |
| 264 matches.addAll(await _searchReferences_Local( | 264 matches.addAll(await _searchReferences_Local(parameter, (AstNode node) { |
| 265 parameter, | 265 AstNode parent = node.parent; |
| 266 (n) => | 266 return parent is ClassDeclaration || parent is CompilationUnit; |
| 267 n is ConstructorDeclaration || | 267 })); |
| 268 n is MethodDeclaration || | |
| 269 n is FunctionExpression)); | |
| 270 return matches; | 268 return matches; |
| 271 } | 269 } |
| 272 | 270 |
| 273 Future<List<SearchMatch>> _searchReferences_Prefix( | 271 Future<List<SearchMatch>> _searchReferences_Prefix( |
| 274 PrefixElement element) async { | 272 PrefixElement element) async { |
| 275 List<SearchMatch> matches = <SearchMatch>[]; | 273 List<SearchMatch> matches = <SearchMatch>[]; |
| 276 LibraryElement libraryElement = element.library; | 274 LibraryElement libraryElement = element.library; |
| 277 Source librarySource = libraryElement.source; | 275 Source librarySource = libraryElement.source; |
| 278 AnalysisContext context = libraryElement.context; | 276 AnalysisContext context = libraryElement.context; |
| 279 for (CompilationUnitElement unitElement in libraryElement.units) { | 277 for (CompilationUnitElement unitElement in libraryElement.units) { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 } | 399 } |
| 402 } else if (isSet) { | 400 } else if (isSet) { |
| 403 kind = MatchKind.WRITE; | 401 kind = MatchKind.WRITE; |
| 404 } | 402 } |
| 405 } | 403 } |
| 406 _addMatch(node, kind); | 404 _addMatch(node, kind); |
| 407 } | 405 } |
| 408 } | 406 } |
| 409 | 407 |
| 410 void _addMatch(AstNode node, MatchKind kind) { | 408 void _addMatch(AstNode node, MatchKind kind) { |
| 411 bool isQualified = node is SimpleIdentifier && node.isQualified; | 409 bool isQualified = node.parent is Label; |
| 412 matches.add(new SearchMatch(context, libraryUri, unitUri, kind, | 410 matches.add(new SearchMatch(context, libraryUri, unitUri, kind, |
| 413 rangeNode(node), true, isQualified)); | 411 rangeNode(node), true, isQualified)); |
| 414 } | 412 } |
| 415 } | 413 } |
| OLD | NEW |