Index: lib/src/codegen/js_codegen.dart |
diff --git a/lib/src/codegen/js_codegen.dart b/lib/src/codegen/js_codegen.dart |
index 005808114b65eefe3e35961473b15a75dcb16424..9939e6016459544e6a2a14b080dca6d06477c667 100644 |
--- a/lib/src/codegen/js_codegen.dart |
+++ b/lib/src/codegen/js_codegen.dart |
@@ -186,14 +186,16 @@ class JSCodegenVisitor extends GeneralizingAstVisitor |
_exports.forEach(moduleBuilder.addExport); |
+ var currentModuleName = compiler.getModuleName(currentLibrary.source.uri); |
var items = <JS.ModuleItem>[]; |
if (!_isDartRuntime) { |
if (currentLibrary.source.isInSystemLibrary) { |
// Force the import order of runtime libs. |
// TODO(ochafik): Reduce this to a minimum. |
- for (var lib in corelibOrder.reversed) { |
- // TODO(ochafik): Use uris instead in corelibOrder. |
- moduleBuilder.addImport(getCorelibModuleName(lib), null); |
+ for (var libUri in corelibOrder.reversed) { |
+ var moduleName = compiler.getModuleName(libUri); |
+ if (moduleName == currentModuleName) continue; |
+ moduleBuilder.addImport(moduleName, null); |
} |
} |
moduleBuilder.addImport('dart/_runtime', _runtimeLibVar); |
@@ -216,7 +218,7 @@ class JSCodegenVisitor extends GeneralizingAstVisitor |
// String scriptTag = null; |
// if (library.library.scriptTag != null) scriptTag = '/usr/bin/env $jsBin'; |
return moduleBuilder.build( |
- compiler.getModuleName(currentLibrary.source.uri), |
+ currentModuleName, |
_jsModuleValue, |
_exportsVar, |
items); |