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

Unified Diff: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/analysis/Context.java

Issue 10810052: Fix analysis of loose files (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/analysis/Context.java
===================================================================
--- editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/analysis/Context.java (revision 9797)
+++ editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/analysis/Context.java (working copy)
@@ -272,21 +272,16 @@
if (library != null) {
return new Library[] {library};
}
- Library[] result = NO_LIBRARIES;
// If this is a file, then return the libraries that source the file
if (file.isFile() || (!file.exists() && DartCore.isDartLikeFileName(file.getName()))) {
- for (Library cachedLibrary : libraryCache.values()) {
- if (cachedLibrary.getSourceFiles().contains(file)) {
- result = append(result, cachedLibrary);
- }
- }
- return result;
+ return getLibrariesSourcing(file);
}
// Otherwise return the libraries containing files in the specified directory tree
+ Library[] result = NO_LIBRARIES;
String prefix = file.getAbsolutePath() + File.separator;
for (Library cachedLibrary : libraryCache.values()) {
for (File sourceFile : cachedLibrary.getSourceFiles()) {
@@ -313,6 +308,21 @@
}
/**
+ * Answer the libraries that source the specified file
+ *
+ * @return an array of libraries (not <code>null</code>, contains no <code>null</code>s)
+ */
+ Library[] getLibrariesSourcing(File file) {
+ Library[] result = NO_LIBRARIES;
+ for (Library cachedLibrary : libraryCache.values()) {
+ if (cachedLibrary.getSourceFiles().contains(file)) {
+ result = append(result, cachedLibrary);
+ }
+ }
+ return result;
+ }
+
+ /**
* Answer the currently cached and resolved libraries
*/
HashMap<URI, LibraryUnit> getResolvedLibraries() {

Powered by Google App Engine
This is Rietveld 408576698