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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 */ | 361 */ |
362 void scanPart(Part part, Uri resolvedUri, LibraryElement library) { | 362 void scanPart(Part part, Uri resolvedUri, LibraryElement library) { |
363 if (!resolvedUri.isAbsolute) throw new ArgumentError(resolvedUri); | 363 if (!resolvedUri.isAbsolute) throw new ArgumentError(resolvedUri); |
364 Uri readableUri = compiler.translateResolvedUri(library, resolvedUri, part); | 364 Uri readableUri = compiler.translateResolvedUri(library, resolvedUri, part); |
365 Script sourceScript = compiler.readScript(readableUri, part); | 365 Script sourceScript = compiler.readScript(readableUri, part); |
366 CompilationUnitElement unit = | 366 CompilationUnitElement unit = |
367 new CompilationUnitElementX(sourceScript, library); | 367 new CompilationUnitElementX(sourceScript, library); |
368 compiler.withCurrentElement(unit, () { | 368 compiler.withCurrentElement(unit, () { |
369 compiler.scanner.scan(unit); | 369 compiler.scanner.scan(unit); |
370 if (unit.partTag == null) { | 370 if (unit.partTag == null) { |
371 bool wasDiagnosticEmitted = false; | 371 compiler.reportError(unit, MessageKind.MISSING_PART_OF_TAG); |
372 compiler.withCurrentElement(library, () { | |
373 wasDiagnosticEmitted = | |
374 compiler.onDeprecatedFeature(part, 'missing part-of tag'); | |
375 }); | |
376 if (wasDiagnosticEmitted) { | |
377 compiler.reportMessage( | |
378 compiler.spanFromElement(unit), | |
379 MessageKind.MISSING_PART_OF_TAG.error(), | |
380 api.Diagnostic.INFO); | |
381 } | |
382 } | 372 } |
383 }); | 373 }); |
384 } | 374 } |
385 | 375 |
386 /** | 376 /** |
387 * Handle an import/export tag by loading the referenced library and | 377 * Handle an import/export tag by loading the referenced library and |
388 * registering its dependency in [handler] for the computation of the import/ | 378 * registering its dependency in [handler] for the computation of the import/ |
389 * export scope. | 379 * export scope. |
390 */ | 380 */ |
391 void registerLibraryFromTag(LibraryDependencyHandler handler, | 381 void registerLibraryFromTag(LibraryDependencyHandler handler, |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 } | 829 } |
840 | 830 |
841 /** | 831 /** |
842 * Registers all top-level entities of [library] as starting point for the | 832 * Registers all top-level entities of [library] as starting point for the |
843 * fixed-point computation of the import/export scopes. | 833 * fixed-point computation of the import/export scopes. |
844 */ | 834 */ |
845 void registerLibraryExports(LibraryElement library) { | 835 void registerLibraryExports(LibraryElement library) { |
846 nodeMap[library].registerInitialExports(); | 836 nodeMap[library].registerInitialExports(); |
847 } | 837 } |
848 } | 838 } |
OLD | NEW |