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

Unified Diff: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/compiler/DartCompilerUtilities.java

Issue 10826047: Replace parsed and resolved maps with cache interface (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
« no previous file with comments | « editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/analysis/SelectiveCacheAdapter.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/utilities/compiler/DartCompilerUtilities.java
===================================================================
--- editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/compiler/DartCompilerUtilities.java (revision 9990)
+++ editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/compiler/DartCompilerUtilities.java (working copy)
@@ -20,6 +20,7 @@
import com.google.dart.compiler.DartArtifactProvider;
import com.google.dart.compiler.DartCompilationError;
import com.google.dart.compiler.DartCompiler;
+import com.google.dart.compiler.DartCompiler.SelectiveCache;
import com.google.dart.compiler.DartCompilerListener;
import com.google.dart.compiler.DartSource;
import com.google.dart.compiler.DefaultCompilerConfiguration;
@@ -765,19 +766,15 @@
* A synchronized call to {@link DartCompiler#analyzeLibraries}
*/
public static Map<URI, LibraryUnit> secureAnalyzeLibraries(LibrarySource librarySource,
- Map<URI, LibraryUnit> resolvedLibs, Map<URI, DartUnit> parsedUnits,
- CompilerConfiguration config, DartArtifactProvider provider,
- SystemLibraryManager libraryManager, DartCompilerListener listener, boolean resolveAllNewLibs)
- throws IOException {
+ SelectiveCache selectiveCache, CompilerConfiguration config, DartArtifactProvider provider,
+ DartCompilerListener listener, boolean resolveAllNewLibs) throws IOException {
// All calls to DartC must be synchronized
synchronized (compilerLock) {
return DartCompiler.analyzeLibraries(
librarySource,
- resolvedLibs,
- parsedUnits,
+ selectiveCache,
config,
provider,
- libraryManager,
listener,
resolveAllNewLibs);
}
@@ -787,10 +784,10 @@
* A synchronized call to {@link DartCompiler#analyzeLibrary}
*/
public static LibraryUnit secureAnalyzeLibrary(LibrarySource librarySource,
- Map<URI, DartUnit> parsedUnits, final CompilerConfiguration config,
+ final Map<URI, DartUnit> parsedUnits, final CompilerConfiguration config,
DartArtifactProvider provider, DartCompilerListener listener) throws IOException {
- EditorLibraryManager manager = SystemLibraryManagerProvider.getSystemLibraryManager();
+ final EditorLibraryManager manager = SystemLibraryManagerProvider.getSystemLibraryManager();
AnalysisServer server = SystemLibraryManagerProvider.getDefaultAnalysisServer();
URI librarySourceUri = librarySource.getUri();
@@ -805,19 +802,39 @@
}
// Resolve the specified library against all currently cached libraries
- Map<URI, LibraryUnit> resolvedLibs = server.getSavedContext().getResolvedLibraries(50);
+ final Map<URI, LibraryUnit> resolvedLibs = server.getSavedContext().getResolvedLibraries(50);
resolvedLibs.remove(librarySourceUri);
+ // Construct the selective cache
+ SelectiveCache selectiveCache = new DartCompiler.SelectiveCache() {
+ @Override
+ public Map<URI, LibraryUnit> getResolvedLibraries() {
+ return resolvedLibs;
+ }
+
+ @Override
+ public DartUnit getUnresolvedDartUnit(DartSource dartSrc) {
+ if (parsedUnits == null) {
+ return null;
+ }
+ URI srcUri = dartSrc.getUri();
+ DartUnit parsedUnit = parsedUnits.remove(srcUri);
+ if (parsedUnit != null) {
+ return parsedUnit;
+ }
+ URI fileUri = manager.resolveDartUri(srcUri);
+ return parsedUnits.remove(fileUri);
+ }
+ };
+
Map<URI, LibraryUnit> libMap;
// All calls to DartC must be synchronized
synchronized (compilerLock) {
libMap = DartCompiler.analyzeLibraries(
librarySource,
- resolvedLibs,
- parsedUnits,
+ selectiveCache,
config,
provider,
- manager,
listener,
false);
}
« no previous file with comments | « editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/analysis/SelectiveCacheAdapter.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698