| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of dart2js; | 5 part of dart2js; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * [CompilerTask] for loading libraries and setting up the import/export scopes. | 8 * [CompilerTask] for loading libraries and setting up the import/export scopes. |
| 9 * | 9 * |
| 10 * The library loader uses four different kinds of URIs in different parts of | 10 * The library loader uses four different kinds of URIs in different parts of |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 }); | 336 }); |
| 337 } | 337 } |
| 338 | 338 |
| 339 void checkDuplicatedLibraryName(LibraryElement library) { | 339 void checkDuplicatedLibraryName(LibraryElement library) { |
| 340 LibraryName tag = library.libraryTag; | 340 LibraryName tag = library.libraryTag; |
| 341 if (tag != null) { | 341 if (tag != null) { |
| 342 String name = library.getLibraryOrScriptName(); | 342 String name = library.getLibraryOrScriptName(); |
| 343 LibraryElement existing = | 343 LibraryElement existing = |
| 344 libraryNames.putIfAbsent(name, () => library); | 344 libraryNames.putIfAbsent(name, () => library); |
| 345 if (!identical(existing, library)) { | 345 if (!identical(existing, library)) { |
| 346 Uri uri = library.entryCompilationUnit.script.uri; | 346 compiler.withCurrentElement(library, () { |
| 347 compiler.reportMessage( | 347 compiler.reportWarning(tag.name, |
| 348 compiler.spanFromSpannable(tag.name, uri), | 348 MessageKind.DUPLICATED_LIBRARY_NAME, |
| 349 MessageKind.DUPLICATED_LIBRARY_NAME.error({'libraryName': name}), | 349 {'libraryName': name}); |
| 350 api.Diagnostic.WARNING); | 350 }); |
| 351 Uri existingUri = existing.entryCompilationUnit.script.uri; | 351 compiler.withCurrentElement(existing, () { |
| 352 compiler.reportMessage( | 352 compiler.reportWarning(existing.libraryTag.name, |
| 353 compiler.spanFromSpannable(existing.libraryTag.name, existingUri), | 353 MessageKind.DUPLICATED_LIBRARY_NAME, |
| 354 MessageKind.DUPLICATED_LIBRARY_NAME.error({'libraryName': name}), | 354 {'libraryName': name}); |
| 355 api.Diagnostic.WARNING); | 355 }); |
| 356 } | 356 } |
| 357 } | 357 } |
| 358 } | 358 } |
| 359 | 359 |
| 360 bool isDartCore(Uri uri) => uri.scheme == "dart" && uri.path == "core"; | 360 bool isDartCore(Uri uri) => uri.scheme == "dart" && uri.path == "core"; |
| 361 | 361 |
| 362 /** | 362 /** |
| 363 * Lazily loads and returns the [LibraryElement] for the dart:core library. | 363 * Lazily loads and returns the [LibraryElement] for the dart:core library. |
| 364 */ | 364 */ |
| 365 Future<LibraryElement> loadCoreLibrary(LibraryDependencyHandler handler) { | 365 Future<LibraryElement> loadCoreLibrary(LibraryDependencyHandler handler) { |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 } | 898 } |
| 899 | 899 |
| 900 /** | 900 /** |
| 901 * Registers all top-level entities of [library] as starting point for the | 901 * Registers all top-level entities of [library] as starting point for the |
| 902 * fixed-point computation of the import/export scopes. | 902 * fixed-point computation of the import/export scopes. |
| 903 */ | 903 */ |
| 904 void registerLibraryExports(LibraryElement library) { | 904 void registerLibraryExports(LibraryElement library) { |
| 905 nodeMap[library].registerInitialExports(); | 905 nodeMap[library].registerInitialExports(); |
| 906 } | 906 } |
| 907 } | 907 } |
| OLD | NEW |