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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 libraryDependencies.addLast(import); | 274 libraryDependencies.addLast(import); |
275 } else if (tag.isExport) { | 275 } else if (tag.isExport) { |
276 tagState = checkTag(TagState.IMPORT_OR_EXPORT, tag); | 276 tagState = checkTag(TagState.IMPORT_OR_EXPORT, tag); |
277 libraryDependencies.addLast(tag); | 277 libraryDependencies.addLast(tag); |
278 } else if (tag.isLibraryName) { | 278 } else if (tag.isLibraryName) { |
279 tagState = checkTag(TagState.LIBRARY, tag); | 279 tagState = checkTag(TagState.LIBRARY, tag); |
280 if (library.libraryTag != null) { | 280 if (library.libraryTag != null) { |
281 compiler.cancel("duplicated library declaration", node: tag); | 281 compiler.cancel("duplicated library declaration", node: tag); |
282 } else { | 282 } else { |
283 library.libraryTag = tag; | 283 library.libraryTag = tag; |
| 284 for (Link link = tag.metadata; !link.isEmpty; link = link.tail) { |
| 285 library.addMetadata(link.head); |
| 286 } |
284 } | 287 } |
285 checkDuplicatedLibraryName(library); | 288 checkDuplicatedLibraryName(library); |
286 } else if (tag.isPart) { | 289 } else if (tag.isPart) { |
287 Part part = tag; | 290 Part part = tag; |
288 StringNode uri = part.uri; | 291 StringNode uri = part.uri; |
289 Uri resolvedUri = base.resolve(uri.dartString.slowToString()); | 292 Uri resolvedUri = base.resolve(uri.dartString.slowToString()); |
290 tagState = checkTag(TagState.SOURCE, part); | 293 tagState = checkTag(TagState.SOURCE, part); |
291 scanPart(part, resolvedUri, library); | 294 scanPart(part, resolvedUri, library); |
292 } else { | 295 } else { |
293 compiler.internalError("Unhandled library tag.", node: tag); | 296 compiler.internalError("Unhandled library tag.", node: tag); |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 } | 834 } |
832 | 835 |
833 /** | 836 /** |
834 * Registers all top-level entities of [library] as starting point for the | 837 * Registers all top-level entities of [library] as starting point for the |
835 * fixed-point computation of the import/export scopes. | 838 * fixed-point computation of the import/export scopes. |
836 */ | 839 */ |
837 void registerLibraryExports(LibraryElement library) { | 840 void registerLibraryExports(LibraryElement library) { |
838 nodeMap[library].registerInitialExports(); | 841 nodeMap[library].registerInitialExports(); |
839 } | 842 } |
840 } | 843 } |
OLD | NEW |