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

Unified Diff: compiler/java/com/google/dart/compiler/SystemLibraryManager.java

Issue 9909012: Prevent duplicate entries in the bundled libraries (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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: compiler/java/com/google/dart/compiler/SystemLibraryManager.java
===================================================================
--- compiler/java/com/google/dart/compiler/SystemLibraryManager.java (revision 5968)
+++ compiler/java/com/google/dart/compiler/SystemLibraryManager.java (working copy)
@@ -304,13 +304,19 @@
* dart://dom/dom.dart)
*/
private void setLibraries(SystemLibrary[] newLibraries) {
- libraries = Lists.newArrayList(newLibraries);
+ libraries = new ArrayList<SystemLibrary>();
hostMap = new HashMap<String, SystemLibrary>();
expansionMap = new HashMap<String, String>();
- for (SystemLibrary library : libraries) {
- hostMap.put(library.getHost(), library);
+ for (SystemLibrary library : newLibraries) {
+ String host = library.getHost();
+ SystemLibrary existingLib = hostMap.get(host);
+ if (existingLib != null) {
+ libraries.remove(existingLib);
+ }
+ libraries.add(library);
+ hostMap.put(host, library);
expansionMap.put(library.getShortName(),
- "//" + library.getHost() + "/" + library.getPathToLib());
+ "//" + host + "/" + library.getPathToLib());
}
}
}
« no previous file with comments | « no previous file | editor/tools/plugins/com.google.dart.tools.core_test/src/com/google/dart/tools/core/internal/model/SystemLibraryManagerProviderTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698