Index: lib/runtime/dart_library.js |
diff --git a/lib/runtime/dart_library.js b/lib/runtime/dart_library.js |
index 12852bbf4dd5b8992eb274c679246f4eae7916ac..223744939e9190cb5cc453bca953af992d60793c 100644 |
--- a/lib/runtime/dart_library.js |
+++ b/lib/runtime/dart_library.js |
@@ -51,7 +51,7 @@ var dart_library = |
handleImports(list, handler) { |
let results = []; |
for (let name of list) { |
- let lib = libraries[name]; |
+ let lib = libraries.get(name); |
ochafik
2015/12/14 02:46:16
Electron doesn't like [] on Map yet?
|
if (!lib) { |
throwLibraryError('Library not available: ' + name); |
} |
@@ -100,16 +100,18 @@ var dart_library = |
// Map from name to LibraryLoader |
let libraries = new Map(); |
+ dart_library.libraries = function() { return libraries.keys(); } |
function library(name, defaultValue, imports, lazyImports, loader) { |
- return libraries[name] = |
- new LibraryLoader(name, defaultValue, imports, lazyImports, loader); |
+ let result = new LibraryLoader(name, defaultValue, imports, lazyImports, loader); |
+ libraries.set(name, result); |
+ return result; |
} |
dart_library.library = library; |
function import_(libraryName) { |
bootstrap(); |
- let loader = libraries[libraryName]; |
+ let loader = libraries.get(libraryName); |
// TODO(vsm): A user might call this directly from JS (as we do in tests). |
// We may want a different error type. |
if (!loader) throwLibraryError('Library not found: ' + libraryName); |