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

Unified Diff: compiler/java/com/google/dart/compiler/ast/LibraryUnit.java

Issue 10379012: Code completion improvements. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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 | editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/completion/CompletionProposal.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/java/com/google/dart/compiler/ast/LibraryUnit.java
===================================================================
--- compiler/java/com/google/dart/compiler/ast/LibraryUnit.java (revision 7347)
+++ compiler/java/com/google/dart/compiler/ast/LibraryUnit.java (working copy)
@@ -17,10 +17,13 @@
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentSkipListMap;
@@ -123,6 +126,30 @@
return prefixes.get(library);
}
+ public LibraryUnit getLibraryWithPrefix(String prefixToMatch) {
+ Iterator<LibraryUnit> libraries = prefixes.keySet().iterator();
+ Iterator<String> prefixStrings = prefixes.values().iterator();
+ while (prefixStrings.hasNext()) {
+ LibraryUnit library = libraries.next();
+ String prefix = prefixStrings.next();
+ if (prefix.equals(prefixToMatch)) {
+ return library;
+ }
+ }
+ return null;
+ }
+
+ public Collection<LibraryUnit> getLibrariesWithPrefix(String prefixToMatch) {
+ Set<Entry<LibraryUnit,String>> entries = prefixes.entrySet();
+ List<LibraryUnit> result = new ArrayList<LibraryUnit>(entries.size());
+ for (Entry<LibraryUnit,String> entry : entries) {
+ if (entry.getValue().equals(prefixToMatch)) {
+ result.add(entry.getKey());
+ }
+ }
+ return result;
+ }
+
public LibraryElement getElement() {
return element;
}
« no previous file with comments | « no previous file | editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/completion/CompletionProposal.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698