| 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 abstract class LibraryLoader extends CompilerTask { | 10 abstract class LibraryLoader extends CompilerTask { |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 | 261 |
| 262 /** | 262 /** |
| 263 * Handle a part tag in the scope of [library]. The [path] given is used as | 263 * Handle a part tag in the scope of [library]. The [path] given is used as |
| 264 * is, any URI resolution should be done beforehand. | 264 * is, any URI resolution should be done beforehand. |
| 265 */ | 265 */ |
| 266 void scanPart(Part part, Uri path, LibraryElement library) { | 266 void scanPart(Part part, Uri path, LibraryElement library) { |
| 267 if (!path.isAbsolute()) throw new ArgumentError(path); | 267 if (!path.isAbsolute()) throw new ArgumentError(path); |
| 268 Script sourceScript = compiler.readScript(path, part); | 268 Script sourceScript = compiler.readScript(path, part); |
| 269 CompilationUnitElement unit = | 269 CompilationUnitElement unit = |
| 270 new CompilationUnitElement(sourceScript, library); | 270 new CompilationUnitElement(sourceScript, library); |
| 271 compiler.withCurrentElement(unit, () => compiler.scanner.scan(unit)); | 271 compiler.withCurrentElement(unit, () { |
| 272 compiler.scanner.scan(unit); |
| 273 if (unit.partTag == null) { |
| 274 bool wasDiagnosticEmitted = false; |
| 275 compiler.withCurrentElement(library, () { |
| 276 wasDiagnosticEmitted = |
| 277 compiler.onDeprecatedFeature(part, 'missing part-of tag'); |
| 278 }); |
| 279 if (wasDiagnosticEmitted) { |
| 280 compiler.reportMessage( |
| 281 compiler.spanFromElement(unit), |
| 282 MessageKind.MISSING_PART_OF_TAG.error([]), |
| 283 api.Diagnostic.INFO); |
| 284 } |
| 285 } |
| 286 }); |
| 272 } | 287 } |
| 273 | 288 |
| 274 /** | 289 /** |
| 275 * Handle an import/export tag by loading the referenced library and | 290 * Handle an import/export tag by loading the referenced library and |
| 276 * registering its dependency in [handler] for the computation of the import/ | 291 * registering its dependency in [handler] for the computation of the import/ |
| 277 * export scope. | 292 * export scope. |
| 278 */ | 293 */ |
| 279 void registerLibraryFromTag(LibraryDependencyHandler handler, | 294 void registerLibraryFromTag(LibraryDependencyHandler handler, |
| 280 LibraryElement library, | 295 LibraryElement library, |
| 281 LibraryDependency tag) { | 296 LibraryDependency tag) { |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 } | 715 } |
| 701 | 716 |
| 702 /** | 717 /** |
| 703 * Registers all top-level entities of [library] as starting point for the | 718 * Registers all top-level entities of [library] as starting point for the |
| 704 * fixed-point computation of the import/export scopes. | 719 * fixed-point computation of the import/export scopes. |
| 705 */ | 720 */ |
| 706 void registerLibraryExports(LibraryElement library) { | 721 void registerLibraryExports(LibraryElement library) { |
| 707 nodeMap[library].registerInitialExports(); | 722 nodeMap[library].registerInitialExports(); |
| 708 } | 723 } |
| 709 } | 724 } |
| OLD | NEW |