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

Unified Diff: pkg/analysis_server/lib/src/domains/analysis/implemented_dart.dart

Issue 2955313003: Use SearchEngine.membersOfSubtypes() instead of actual elements in ImplementedComputer. (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/domains/analysis/implemented_dart.dart
diff --git a/pkg/analysis_server/lib/src/domains/analysis/implemented_dart.dart b/pkg/analysis_server/lib/src/domains/analysis/implemented_dart.dart
index 43f79d72360b1f21a35a09a6c93f825e8f39e893..54f997349205270ab4c96f229095a4628d55085d 100644
--- a/pkg/analysis_server/lib/src/domains/analysis/implemented_dart.dart
+++ b/pkg/analysis_server/lib/src/domains/analysis/implemented_dart.dart
@@ -13,13 +13,13 @@ class ImplementedComputer {
List<protocol.ImplementedClass> classes = <protocol.ImplementedClass>[];
List<protocol.ImplementedMember> members = <protocol.ImplementedMember>[];
- Set<ClassElement> subtypes;
+ Set<String> subtypeMembers;
ImplementedComputer(this.searchEngine, this.unitElement);
compute() async {
for (ClassElement type in unitElement.types) {
- // always include Object and its members
+ // Always include Object and its members.
if (type.supertype == null) {
_addImplementedClass(type);
type.accessors.forEach(_addImplementedMember);
@@ -27,14 +27,15 @@ class ImplementedComputer {
type.methods.forEach(_addImplementedMember);
continue;
}
- // analyze ancestors
- subtypes = await searchEngine.searchAllSubtypes(type);
- if (subtypes.isNotEmpty) {
+
+ // Analyze subtypes.
+ subtypeMembers = await searchEngine.membersOfSubtypes(type);
+ if (subtypeMembers != null) {
_addImplementedClass(type);
+ type.accessors.forEach(_addMemberIfImplemented);
+ type.fields.forEach(_addMemberIfImplemented);
+ type.methods.forEach(_addMemberIfImplemented);
}
- type.accessors.forEach(_addMemberIfImplemented);
- type.fields.forEach(_addMemberIfImplemented);
- type.methods.forEach(_addMemberIfImplemented);
}
}
@@ -61,19 +62,7 @@ class ImplementedComputer {
bool _hasOverride(Element element) {
String name = element.displayName;
- LibraryElement library = element.library;
- for (ClassElement subtype in subtypes) {
- ClassMemberElement subElement = subtype.getMethod(name);
- if (subElement == null) {
- subElement = subtype.getField(name);
- }
- if (subElement != null &&
- !subElement.isStatic &&
- subElement.isAccessibleIn(library)) {
- return true;
- }
- }
- return false;
+ return subtypeMembers.contains(name);
}
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698