Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(741)

Unified Diff: pkg/analyzer/lib/src/dart/analysis/search.dart

Issue 2674493004: Implement Search.classMembers() using getFilesDefiningClassMemberName(). (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/lib/src/dart/analysis/search.dart
diff --git a/pkg/analyzer/lib/src/dart/analysis/search.dart b/pkg/analyzer/lib/src/dart/analysis/search.dart
index 312d7a2c75c8b6dbfd94ca4b709704558cacbc03..8b81db95a132a2a595310aed1c654cff51b1b8d4 100644
--- a/pkg/analyzer/lib/src/dart/analysis/search.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/search.dart
@@ -34,20 +34,20 @@ class Search {
Search(this._driver);
/**
- * Returns class members with names matching the given [regExp].
+ * Returns class members with the given [name].
*/
- Future<List<Element>> classMembers(RegExp regExp) async {
+ Future<List<Element>> classMembers(String name) async {
List<Element> elements = <Element>[];
void addElement(Element element) {
- if (!element.isSynthetic && regExp.hasMatch(element.displayName)) {
+ if (!element.isSynthetic && element.displayName == name) {
elements.add(element);
}
}
- for (FileState file in _driver.fsState.knownFiles) {
- CompilationUnitElement unitElement =
- await _driver.getUnitElement(file.path);
+ List<String> files = await _driver.getFilesDefiningClassMemberName(name);
+ for (String file in files) {
+ CompilationUnitElement unitElement = await _driver.getUnitElement(file);
if (unitElement != null) {
for (ClassElement clazz in unitElement.types) {
clazz.accessors.forEach(addElement);

Powered by Google App Engine
This is Rietveld 408576698