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

Unified Diff: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/index/impl/InMemoryIndex.java

Issue 10692002: pass library files not directories to analysis server (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | « editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/analysis/Context.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/index/impl/InMemoryIndex.java
===================================================================
--- editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/index/impl/InMemoryIndex.java (revision 9145)
+++ editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/index/impl/InMemoryIndex.java (working copy)
@@ -17,7 +17,6 @@
import com.google.dart.compiler.LibrarySource;
import com.google.dart.compiler.SystemLibraryManager;
import com.google.dart.compiler.ast.DartUnit;
-import com.google.dart.compiler.ast.LibraryUnit;
import com.google.dart.tools.core.DartCore;
import com.google.dart.tools.core.DartCoreDebug;
import com.google.dart.tools.core.analysis.AnalysisServer;
@@ -71,7 +70,6 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
-import java.util.HashSet;
/**
* The unique instance of the class <code>InMemoryIndex</code> maintains an in-memory {@link Index
@@ -471,7 +469,11 @@
DartModel model = DartCore.create(ResourcesPlugin.getWorkspace().getRoot());
for (DartProject project : model.getDartProjects()) {
for (DartLibrary library : project.getDartLibraries()) {
- IResource libraryResource = library.getResource();
+ CompilationUnit compilationUnit = library.getDefiningCompilationUnit();
+ if (compilationUnit == null) {
+ continue;
+ }
+ IResource libraryResource = compilationUnit.getResource();
if (libraryResource == null) {
continue;
}
@@ -494,41 +496,6 @@
}
/**
- * Initialize this index with information from the given user library.
- *
- * @param libraryUnit the library to be used to initialize the index
- * @param initializedLibraries the URI's of libraries that have already been used to initialize
- * the index
- */
- private void indexUserLibrary(LibraryUnit libraryUnit, HashSet<URI> initializedLibraries) {
- LibrarySource librarySource = libraryUnit.getSource();
- URI libraryUri = librarySource.getUri();
- if (SystemLibraryManager.isDartUri(libraryUri) || initializedLibraries.contains(libraryUri)) {
- return;
- }
- initializedLibraries.add(libraryUri);
- DartLibraryImpl library = new DartLibraryImpl(librarySource);
- for (DartUnit ast : libraryUnit.getUnits()) {
- DartSource unitSource = (DartSource) ast.getSourceInfo().getSource();
- URI unitUri = unitSource.getUri();
- Resource resource = new Resource(unitUri.toString());
- CompilationUnit compilationUnit = new CompilationUnitImpl(
- library,
- unitUri,
- DefaultWorkingCopyOwner.getInstance());
- // library.getCompilationUnit(unitUri);
- long startTime = System.currentTimeMillis();
- indexResource(resource, compilationUnit, ast);
- long endTime = System.currentTimeMillis();
- initIndexingTime += endTime - startTime;
- }
- for (LibraryUnit importedLibrary : libraryUnit.getImportedLibraries()) {
- // library.getImportedLibrary(importedLibrary.getSource().getUri());
- indexUserLibrary(importedLibrary, initializedLibraries);
- }
- }
-
- /**
* Initialize this index to contain information about the bundled libraries. The index store is
* expected to have been cleared before invoking this method.
*
« no previous file with comments | « editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/analysis/Context.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698