| 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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 Future registerLibraryFromTag(LibraryDependencyHandler handler, | 414 Future registerLibraryFromTag(LibraryDependencyHandler handler, |
| 415 LibraryElement library, | 415 LibraryElement library, |
| 416 LibraryDependency tag) { | 416 LibraryDependency tag) { |
| 417 Uri base = library.entryCompilationUnit.script.uri; | 417 Uri base = library.entryCompilationUnit.script.uri; |
| 418 Uri resolvedUri = base.resolve(tag.uri.dartString.slowToString()); | 418 Uri resolvedUri = base.resolve(tag.uri.dartString.slowToString()); |
| 419 return createLibrary(handler, library, resolvedUri, tag.uri, resolvedUri) | 419 return createLibrary(handler, library, resolvedUri, tag.uri, resolvedUri) |
| 420 .then((LibraryElement loadedLibrary) { | 420 .then((LibraryElement loadedLibrary) { |
| 421 if (loadedLibrary == null) return; | 421 if (loadedLibrary == null) return; |
| 422 compiler.withCurrentElement(library, () { | 422 compiler.withCurrentElement(library, () { |
| 423 handler.registerDependency(library, tag, loadedLibrary); | 423 handler.registerDependency(library, tag, loadedLibrary); |
| 424 | |
| 425 if (!loadedLibrary.hasLibraryName()) { | |
| 426 compiler.reportFatalError( | |
| 427 tag == null ? null : tag.uri, | |
| 428 MessageKind.GENERIC, | |
| 429 {'text': | |
| 430 'Error: No library name found in ' | |
| 431 '${loadedLibrary.canonicalUri}.'}); | |
| 432 } | |
| 433 }); | 424 }); |
| 434 }); | 425 }); |
| 435 } | 426 } |
| 436 | 427 |
| 437 /** | 428 /** |
| 438 * Create (or reuse) a library element for the library specified by the | 429 * Create (or reuse) a library element for the library specified by the |
| 439 * [resolvedUri]. | 430 * [resolvedUri]. |
| 440 * | 431 * |
| 441 * If a new library is created, the [handler] is notified. | 432 * If a new library is created, the [handler] is notified. |
| 442 */ | 433 */ |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 } | 859 } |
| 869 | 860 |
| 870 /** | 861 /** |
| 871 * Registers all top-level entities of [library] as starting point for the | 862 * Registers all top-level entities of [library] as starting point for the |
| 872 * fixed-point computation of the import/export scopes. | 863 * fixed-point computation of the import/export scopes. |
| 873 */ | 864 */ |
| 874 void registerLibraryExports(LibraryElement library) { | 865 void registerLibraryExports(LibraryElement library) { |
| 875 nodeMap[library].registerInitialExports(); | 866 nodeMap[library].registerInitialExports(); |
| 876 } | 867 } |
| 877 } | 868 } |
| OLD | NEW |