Index: sdk/lib/_internal/compiler/implementation/deferred_load.dart |
diff --git a/sdk/lib/_internal/compiler/implementation/deferred_load.dart b/sdk/lib/_internal/compiler/implementation/deferred_load.dart |
index 47ea3a1bc0c4f059188e0f53938d5992644f837a..1b6dcc65f39dd49a6be7ec0acc29c333afda4678 100644 |
--- a/sdk/lib/_internal/compiler/implementation/deferred_load.dart |
+++ b/sdk/lib/_internal/compiler/implementation/deferred_load.dart |
@@ -618,12 +618,18 @@ class DeferredLoadTask extends CompilerTask { |
bool deferredUsedFromMain = false; |
var lastDeferred; |
for (LibraryElement library in compiler.libraries.values) { |
+ Map<String, List<Import>> prefixImports = {}; |
floitsch
2014/02/17 14:39:26
Move outside the loop, and just clear it at every
sigurdm
2014/02/18 08:49:53
Done.
|
// TODO(sigurdm): Make helper getLibraryImportTags when tags is a List |
// instead of a Link. |
for (LibraryTag tag in library.tags) { |
if (tag is! Import) continue; |
Import import = tag; |
if (_isImportDeferred(import)) { |
+ if (import.prefix == null) { |
+ compiler.reportError( |
+ import, |
+ MessageKind.DEFERRED_LIBRARY_WITHOUT_PREFIX); |
+ } |
splitProgram = true; |
_allDeferredImports[tag] = library.getLibraryFromTag(tag); |
lastDeferred = import.metadata.first; |
@@ -631,6 +637,20 @@ class DeferredLoadTask extends CompilerTask { |
deferredUsedFromMain = true; |
} |
} |
+ if (import.prefix != null) { |
+ prefixImports.putIfAbsent(import.prefix.toString(), |
+ () => new List<Import>()).add(import); |
floitsch
2014/02/17 14:39:26
Instead of allocating a new closure/list every tim
sigurdm
2014/02/18 08:49:53
I wanted to do something like that first - but it
|
+ } |
+ } |
+ for (String prefix in prefixImports.keys) { |
+ List<Import> imports = prefixImports[prefix]; |
+ if (imports.length <= 1) continue; |
+ for (Import import in imports) { |
+ if (_isImportDeferred(import)) { |
+ compiler.reportError(import, |
+ MessageKind.DEFERRED_LIBRARY_DUPLICATE_PREFIX); |
+ } |
+ } |
} |
} |
if (splitProgram && !deferredUsedFromMain) { |