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

Unified Diff: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/analysis/AnalysisUtility.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/AnalysisUtility.java
===================================================================
--- editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/analysis/AnalysisUtility.java (revision 7495)
+++ editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/analysis/AnalysisUtility.java (working copy)
@@ -102,6 +102,8 @@
/**
* Resolve the specified library and any imported libraries that have not already been resolved.
*
+ * @param parsedUnits A collection of unresolved ASTs that should be used instead of parsing the
+ * associated source from storage. Units are removed from this map as they are used.
* @return a map of newly resolved libraries
*/
static Map<URI, LibraryUnit> resolve(AnalysisServer server, Library library,
@@ -112,18 +114,21 @@
LibrarySource librarySource = library.getLibrarySource();
provider.clearCachedArtifacts();
+ // analyzeLibraries modifies map of parsed units,
+ // thus we copy the map to know which units were already parsed
+ // before calling analyzeLibraries
+ HashMap<URI, DartUnit> parsedUnitsCopy = new HashMap<URI, DartUnit>(parsedUnits);
+
Map<URI, LibraryUnit> newlyResolved = null;
try {
- // analyzeLibraries modifies map of parsed units, so pass a copy
- HashMap<URI, DartUnit> parsedUnitsCopy = new HashMap<URI, DartUnit>(parsedUnits.size());
- parsedUnitsCopy.putAll(parsedUnits);
newlyResolved = DartCompilerUtilities.secureAnalyzeLibraries(
librarySource,
resolvedLibs,
- parsedUnitsCopy,
+ parsedUnits,
config,
provider,
+ server.getLibraryManager(),
errorListener,
true);
} catch (IOException e) {
@@ -142,7 +147,7 @@
newlyResolved = new HashMap<URI, LibraryUnit>();
newlyResolved.put(libraryFile.toURI(), new LibraryUnit(librarySource));
}
- notifyParsedDuringResolve(server, parsedUnits, newlyResolved.values(), errorListener);
+ notifyParsedDuringResolve(server, parsedUnitsCopy, newlyResolved.values(), errorListener);
errorListener.notifyResolved(newlyResolved);
return newlyResolved;
}

Powered by Google App Engine
This is Rietveld 408576698