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

Unified Diff: compiler/java/com/google/dart/compiler/resolver/Elements.java

Issue 11066004: Issue 5628. Quick fixes should suggest to use existing element with close name (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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: compiler/java/com/google/dart/compiler/resolver/Elements.java
diff --git a/compiler/java/com/google/dart/compiler/resolver/Elements.java b/compiler/java/com/google/dart/compiler/resolver/Elements.java
index 1dc381ee77d4b26dc40cd9c0e251aeb54167a0d8..de23bb95a57a417b0f287b4952445db006e78f33 100644
--- a/compiler/java/com/google/dart/compiler/resolver/Elements.java
+++ b/compiler/java/com/google/dart/compiler/resolver/Elements.java
@@ -6,7 +6,9 @@ package com.google.dart.compiler.resolver;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Objects;
+import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
import com.google.dart.compiler.DartSource;
import com.google.dart.compiler.LibrarySource;
import com.google.dart.compiler.Source;
@@ -822,4 +824,31 @@ static FieldElementImplementation fieldFromNode(DartField node,
public static DuplicateElement createDuplicateElement(Element oldElement, Element newElement) {
return new DuplicateElementImplementation(oldElement, newElement);
}
+
+
+ public static List<Element> getAllMembers(ClassElement classElement) {
+ List<Element> allMembers = Lists.newArrayList();
+ Set<ClassElement> visited = Sets.newHashSet();
+ addAllMembers(visited, allMembers, classElement);
+ return allMembers;
+ }
+
+ private static void addAllMembers(Set<ClassElement> visited, List<Element> allMembers, ClassElement classElement) {
+ if (classElement == null) {
+ return;
+ }
+ if (visited.contains(classElement)) {
+ return;
+ }
+ visited.add(classElement);
+ Iterables.addAll(allMembers, classElement.getMembers());
+ {
+ InterfaceType superType = classElement.getSupertype();
+ if (superType != null)
+ addAllMembers(visited, allMembers, superType.getElement());
+ }
+ for (InterfaceType intf : classElement.getInterfaces()) {
+ addAllMembers(visited, allMembers, intf.getElement());
+ }
+ }
}
« no previous file with comments | « no previous file | editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/correction/CorrectionMessages.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698