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

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

Issue 10389074: Cache unresolved units separately from libraries (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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/ResolveLibraryTask.java
===================================================================
--- editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/analysis/ResolveLibraryTask.java (revision 7495)
+++ editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/analysis/ResolveLibraryTask.java (working copy)
@@ -14,6 +14,7 @@
package com.google.dart.tools.core.analysis;
import com.google.dart.compiler.LibrarySource;
+import com.google.dart.compiler.ast.DartDirective;
import com.google.dart.compiler.ast.DartUnit;
import com.google.dart.compiler.ast.LibraryUnit;
@@ -23,9 +24,8 @@
import java.io.File;
import java.net.URI;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
/**
* Resolve types and references in the specified library
@@ -56,16 +56,12 @@
// Collect resolved libraries and parsed units
HashMap<URI, LibraryUnit> resolvedLibs = new HashMap<URI, LibraryUnit>();
- HashMap<URI, DartUnit> parsedUnits = new HashMap<URI, DartUnit>();
+ HashMap<URI, DartUnit> parsedUnits = context.getUnresolvedUnits();
for (Library lib : context.getCachedLibraries()) {
LibraryUnit libUnit = lib.getLibraryUnit();
if (libUnit != null) {
resolvedLibs.put(libUnit.getSource().getUri(), libUnit);
- } else {
- for (Entry<File, DartUnit> entry : lib.getCachedUnits().entrySet()) {
- parsedUnits.put(entry.getKey().toURI(), entry.getValue());
- }
}
}
@@ -83,9 +79,8 @@
Library lib = context.getCachedLibrary(libFile);
if (lib == null) {
LibrarySource librarySource = libUnit.getSource();
- DartUnit unit = libUnit.getSelfDartUnit();
- Set<String> prefixes = libUnit.getPrefixes();
- lib = Library.fromDartUnit(server, libFile, librarySource, unit, prefixes);
+ List<DartDirective> directives = libUnit.getSelfDartUnit().getDirectives();
+ lib = Library.fromDartUnit(server, libFile, librarySource, directives);
context.cacheLibrary(lib);
}
lib.cacheLibraryUnit(server, libUnit);

Powered by Google App Engine
This is Rietveld 408576698