| Index: sdk/lib/_internal/compiler/implementation/library_loader.dart
|
| diff --git a/sdk/lib/_internal/compiler/implementation/library_loader.dart b/sdk/lib/_internal/compiler/implementation/library_loader.dart
|
| index 85191f17ef019e4440efdf532f39c81134e4eff7..0e34da1c07e9d19f920fa56d348f6d497922caeb 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/library_loader.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/library_loader.dart
|
| @@ -521,36 +521,18 @@ class ImportLink {
|
| var combinatorFilter = new CombinatorFilter.fromTag(import);
|
| if (import != null && import.prefix != null) {
|
| SourceString prefix = import.prefix.source;
|
| - Element e = importingLibrary.find(prefix);
|
| - if (e == null) {
|
| - e = new PrefixElementX(prefix, importingLibrary.entryCompilationUnit,
|
| - import.getBeginToken());
|
| - importingLibrary.addToScope(e, compiler);
|
| - }
|
| - if (!identical(e.kind, ElementKind.PREFIX)) {
|
| - compiler.withCurrentElement(e, () {
|
| - compiler.reportWarning(e, 'duplicated definition');
|
| - });
|
| - compiler.reportFatalError(
|
| - import.prefix,
|
| - MessageKind.GENERIC, {'text': 'Error: Duplicate definition.'});
|
| + Element existingElement = importingLibrary.find(prefix);
|
| + PrefixElement prefixElement;
|
| + if (existingElement == null || !existingElement.isPrefix()) {
|
| + prefixElement = new PrefixElementX(prefix,
|
| + importingLibrary.entryCompilationUnit, import.getBeginToken());
|
| + } else {
|
| + prefixElement = existingElement;
|
| }
|
| - PrefixElement prefixElement = e;
|
| + importingLibrary.addToScope(prefixElement, compiler);
|
| importedLibrary.forEachExport((Element element) {
|
| if (combinatorFilter.exclude(element)) return;
|
| - // TODO(johnniwinther): Clean-up like [checkDuplicateLibraryName].
|
| - Element existing =
|
| - prefixElement.imported.putIfAbsent(element.name, () => element);
|
| - if (!identical(existing, element)) {
|
| - compiler.withCurrentElement(existing, () {
|
| - compiler.reportWarning(existing, 'duplicated import');
|
| - });
|
| - compiler.withCurrentElement(element, () {
|
| - compiler.reportFatalError(
|
| - element,
|
| - MessageKind.GENERIC, {'text': 'Error: Duplicated import.'});
|
| - });
|
| - }
|
| + prefixElement.addImport(element, import, compiler);
|
| });
|
| } else {
|
| importedLibrary.forEachExport((Element element) {
|
|
|