Chromium Code Reviews| 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..1f0040aba2deb0df0882fbcd178dc92640658686 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/deferred_load.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/deferred_load.dart |
| @@ -617,13 +617,20 @@ class DeferredLoadTask extends CompilerTask { |
| _allDeferredImports[_fakeMainImport] = compiler.mainApp; |
| bool deferredUsedFromMain = false; |
| var lastDeferred; |
| + Map<String, List<Import>> prefixImports = new Map<String, List<Import>>(); |
| for (LibraryElement library in compiler.libraries.values) { |
| + prefixImports.clear(); |
| // 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 +638,20 @@ class DeferredLoadTask extends CompilerTask { |
| deferredUsedFromMain = true; |
| } |
| } |
| + if (import.prefix != null) { |
|
floitsch
2014/02/18 09:45:22
Add comment explaining why simpler approaches woul
|
| + prefixImports.putIfAbsent(import.prefix.toString(), |
| + () => new List<Import>()).add(import); |
| + } |
| + } |
| + 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) { |