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 library leg_apiimpl; | 5 library leg_apiimpl; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:package_config/packages.dart'; | 9 import 'package:package_config/packages.dart'; |
10 import 'package:package_config/packages_file.dart' as pkgs; | 10 import 'package:package_config/packages_file.dart' as pkgs; |
11 import 'package:package_config/src/packages_impl.dart' | 11 import 'package:package_config/src/packages_impl.dart' |
12 show MapPackages, NonFilePackagesDirectoryPackages; | 12 show MapPackages, NonFilePackagesDirectoryPackages; |
13 import 'package:package_config/src/util.dart' show checkValidPackageUri; | 13 import 'package:package_config/src/util.dart' show checkValidPackageUri; |
14 | 14 |
15 import '../compiler_new.dart' as api; | 15 import '../compiler_new.dart' as api; |
16 import 'common/tasks.dart' show GenericTask, Measurer; | 16 import 'common/tasks.dart' show GenericTask, Measurer; |
17 import 'common.dart'; | 17 import 'common.dart'; |
18 import 'compiler.dart'; | 18 import 'compiler.dart'; |
19 import 'diagnostics/messages.dart' show Message; | 19 import 'diagnostics/messages.dart' show Message; |
20 import 'elements/elements.dart' as elements; | 20 import 'elements/elements.dart' as elements; |
21 import 'environment.dart'; | 21 import 'environment.dart'; |
| 22 import 'library_loader.dart'; |
22 import 'io/source_file.dart'; | 23 import 'io/source_file.dart'; |
23 import 'options.dart' show CompilerOptions; | 24 import 'options.dart' show CompilerOptions; |
24 import 'platform_configuration.dart' as platform_configuration; | 25 import 'platform_configuration.dart' as platform_configuration; |
25 import 'resolved_uri_translator.dart'; | 26 import 'resolved_uri_translator.dart'; |
26 import 'script.dart'; | 27 import 'script.dart'; |
27 | 28 |
28 /// Implements the [Compiler] using a [api.CompilerInput] for supplying the | 29 /// Implements the [Compiler] using a [api.CompilerInput] for supplying the |
29 /// sources. | 30 /// sources. |
30 class CompilerImpl extends Compiler { | 31 class CompilerImpl extends Compiler { |
31 final Measurer measurer; | 32 final Measurer measurer; |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 try { | 348 try { |
348 return userPackagesDiscoveryTask | 349 return userPackagesDiscoveryTask |
349 .measureIo(() => options.packagesDiscoveryProvider(uri)); | 350 .measureIo(() => options.packagesDiscoveryProvider(uri)); |
350 } catch (ex, s) { | 351 } catch (ex, s) { |
351 reportCrashInUserCode('Uncaught exception in package discovery', ex, s); | 352 reportCrashInUserCode('Uncaught exception in package discovery', ex, s); |
352 rethrow; | 353 rethrow; |
353 } | 354 } |
354 } | 355 } |
355 | 356 |
356 Uri resolvePatchUri(String libraryName) { | 357 Uri resolvePatchUri(String libraryName) { |
357 return backend.resolvePatchUri(libraryName, options.platformConfigUri); | 358 return LibraryLoaderTask.resolvePatchUri( |
| 359 libraryName, options.platformConfigUri); |
358 } | 360 } |
359 } | 361 } |
360 | 362 |
361 class _Environment implements Environment { | 363 class _Environment implements Environment { |
362 final Map<String, String> definitions; | 364 final Map<String, String> definitions; |
363 | 365 |
364 // TODO(sigmund): break the circularity here: Compiler needs an environment to | 366 // TODO(sigmund): break the circularity here: Compiler needs an environment to |
365 // initialize the library loader, but the environment here needs to know about | 367 // initialize the library loader, but the environment here needs to know about |
366 // how the sdk is set up and about whether the backend supports mirrors. | 368 // how the sdk is set up and about whether the backend supports mirrors. |
367 CompilerImpl compiler; | 369 CompilerImpl compiler; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 } | 411 } |
410 } | 412 } |
411 | 413 |
412 /// For every 'dart:' library, a corresponding environment variable is set | 414 /// For every 'dart:' library, a corresponding environment variable is set |
413 /// to "true". The environment variable's name is the concatenation of | 415 /// to "true". The environment variable's name is the concatenation of |
414 /// this prefix and the name (without the 'dart:'. | 416 /// this prefix and the name (without the 'dart:'. |
415 /// | 417 /// |
416 /// For example 'dart:html' has the environment variable 'dart.library.html' set | 418 /// For example 'dart:html' has the environment variable 'dart.library.html' set |
417 /// to "true". | 419 /// to "true". |
418 const String _dartLibraryEnvironmentPrefix = 'dart.library.'; | 420 const String _dartLibraryEnvironmentPrefix = 'dart.library.'; |
OLD | NEW |