Chromium Code Reviews| 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 services.src.search.search_engine2; | 5 library services.src.search.search_engine2; |
| 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/index2/index2.dart'; | 10 import 'package:analysis_server/src/services/index2/index2.dart'; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 MatchKind.REFERENCE); | 134 MatchKind.REFERENCE); |
| 135 return matches; | 135 return matches; |
| 136 } | 136 } |
| 137 | 137 |
| 138 Future<List<SearchMatch>> _searchReferences_Field( | 138 Future<List<SearchMatch>> _searchReferences_Field( |
| 139 PropertyInducingElement field) async { | 139 PropertyInducingElement field) async { |
| 140 List<SearchMatch> matches = <SearchMatch>[]; | 140 List<SearchMatch> matches = <SearchMatch>[]; |
| 141 PropertyAccessorElement getter = field.getter; | 141 PropertyAccessorElement getter = field.getter; |
| 142 PropertyAccessorElement setter = field.setter; | 142 PropertyAccessorElement setter = field.setter; |
| 143 // field itself | 143 // field itself |
| 144 await _addMatches(matches, field, IndexRelationKind.IS_REFERENCED_BY, | 144 if (!field.isSynthetic) { |
| 145 MatchKind.REFERENCE); | 145 await _addMatches(matches, field, IndexRelationKind.IS_REFERENCED_BY, |
| 146 MatchKind.REFERENCE); | |
| 147 } | |
| 146 // getter | 148 // getter |
| 147 if (getter != null) { | 149 if (getter != null) { |
| 148 await _addMatches( | 150 await _addMatches( |
| 149 matches, getter, IndexRelationKind.IS_REFERENCED_BY, MatchKind.READ); | 151 matches, getter, IndexRelationKind.IS_REFERENCED_BY, MatchKind.READ); |
| 150 await _addMatches(matches, getter, IndexRelationKind.IS_INVOKED_BY, | 152 await _addMatches(matches, getter, IndexRelationKind.IS_INVOKED_BY, |
| 151 MatchKind.INVOCATION); | 153 MatchKind.INVOCATION); |
| 152 } | 154 } |
| 153 // setter | 155 // setter |
| 154 if (setter != null) { | 156 if (setter != null) { |
| 155 await _addMatches( | 157 await _addMatches( |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 281 context = element.context, | 283 context = element.context, |
| 282 libraryUri = element.library.source.uri.toString() { | 284 libraryUri = element.library.source.uri.toString() { |
| 283 importedElements = new NamespaceBuilder() | 285 importedElements = new NamespaceBuilder() |
| 284 .createImportNamespaceForDirective(element) | 286 .createImportNamespaceForDirective(element) |
| 285 .definedNames | 287 .definedNames |
| 286 .values | 288 .values |
| 287 .toSet(); | 289 .toSet(); |
| 288 } | 290 } |
| 289 | 291 |
| 290 @override | 292 @override |
| 293 visitImportDirective(ImportDirective node) {} | |
|
Brian Wilkerson
2016/03/10 21:08:14
Do we need to do the equivalent for export directi
| |
| 294 | |
| 295 @override | |
| 291 visitSimpleIdentifier(SimpleIdentifier node) { | 296 visitSimpleIdentifier(SimpleIdentifier node) { |
| 292 if (node.inDeclarationContext()) { | 297 if (node.inDeclarationContext()) { |
| 293 return; | 298 return; |
| 294 } | 299 } |
| 295 if (importElement.prefix != null) { | 300 if (importElement.prefix != null) { |
| 296 if (node.staticElement == importElement.prefix) { | 301 if (node.staticElement == importElement.prefix) { |
| 297 AstNode parent = node.parent; | 302 AstNode parent = node.parent; |
| 298 if (parent is PrefixedIdentifier && parent.prefix == node) { | 303 if (parent is PrefixedIdentifier && parent.prefix == node) { |
| 299 if (importedElements.contains(parent.staticElement)) { | 304 if (importedElements.contains(parent.staticElement)) { |
| 300 _addMatchForPrefix(node, parent.identifier); | 305 _addMatchForPrefix(node, parent.identifier); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 374 _addMatch(node, kind); | 379 _addMatch(node, kind); |
| 375 } | 380 } |
| 376 } | 381 } |
| 377 | 382 |
| 378 void _addMatch(AstNode node, MatchKind kind) { | 383 void _addMatch(AstNode node, MatchKind kind) { |
| 379 bool isQualified = node is SimpleIdentifier && node.isQualified; | 384 bool isQualified = node is SimpleIdentifier && node.isQualified; |
| 380 matches.add(new SearchMatch(context, libraryUri, unitUri, kind, | 385 matches.add(new SearchMatch(context, libraryUri, unitUri, kind, |
| 381 rangeNode(node), true, isQualified)); | 386 rangeNode(node), true, isQualified)); |
| 382 } | 387 } |
| 383 } | 388 } |
| OLD | NEW |