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 import 'dart:convert'; | 8 import 'dart:convert'; |
9 | 9 |
10 import 'package:package_config/packages.dart'; | 10 import 'package:package_config/packages.dart'; |
11 import 'package:package_config/packages_file.dart' as pkgs; | 11 import 'package:package_config/packages_file.dart' as pkgs; |
12 import 'package:package_config/src/packages_impl.dart' show | 12 import 'package:package_config/src/packages_impl.dart' show |
13 MapPackages, | 13 MapPackages, |
14 NonFilePackagesDirectoryPackages; | 14 NonFilePackagesDirectoryPackages; |
15 import 'package:package_config/src/util.dart' show | 15 import 'package:package_config/src/util.dart' show |
16 checkValidPackageUri; | 16 checkValidPackageUri; |
17 | 17 |
18 import '../compiler_new.dart' as api; | 18 import '../compiler_new.dart' as api; |
19 import 'commandline_options.dart'; | |
20 import 'common.dart'; | 19 import 'common.dart'; |
21 import 'common/tasks.dart' show | 20 import 'common/tasks.dart' show |
22 GenericTask; | 21 GenericTask; |
23 import 'compiler.dart'; | 22 import 'compiler.dart'; |
24 import 'diagnostics/diagnostic_listener.dart' show | |
25 DiagnosticOptions; | |
26 import 'diagnostics/messages.dart' show | 23 import 'diagnostics/messages.dart' show |
27 Message; | 24 Message; |
28 import 'elements/elements.dart' as elements; | 25 import 'elements/elements.dart' as elements; |
29 import 'environment.dart'; | 26 import 'environment.dart'; |
30 import 'io/source_file.dart'; | 27 import 'io/source_file.dart'; |
| 28 import 'options.dart' show |
| 29 CompilerOptions; |
31 import 'platform_configuration.dart' as platform_configuration; | 30 import 'platform_configuration.dart' as platform_configuration; |
32 import 'script.dart'; | 31 import 'script.dart'; |
33 | 32 |
34 | 33 |
35 /// Implements the [Compiler] using a [api.CompilerInput] for supplying the | 34 /// Implements the [Compiler] using a [api.CompilerInput] for supplying the |
36 /// sources. | 35 /// sources. |
37 class CompilerImpl extends Compiler { | 36 class CompilerImpl extends Compiler { |
38 api.CompilerInput provider; | 37 api.CompilerInput provider; |
39 api.CompilerDiagnostics handler; | 38 api.CompilerDiagnostics handler; |
40 Packages packages; | 39 Packages packages; |
41 bool mockableLibraryUsed = false; | 40 bool mockableLibraryUsed = false; |
42 | 41 |
43 /// A mapping of the dart: library-names to their location. | 42 /// A mapping of the dart: library-names to their location. |
44 /// | 43 /// |
45 /// Initialized in [setupSdk]. | 44 /// Initialized in [setupSdk]. |
46 Map<String, Uri> sdkLibraries; | 45 Map<String, Uri> sdkLibraries; |
47 | 46 |
48 GenericTask userHandlerTask; | 47 GenericTask userHandlerTask; |
49 GenericTask userProviderTask; | 48 GenericTask userProviderTask; |
50 GenericTask userPackagesDiscoveryTask; | 49 GenericTask userPackagesDiscoveryTask; |
51 | 50 |
52 Uri get libraryRoot => options.platformConfigUri.resolve("."); | 51 Uri get libraryRoot => options.platformConfigUri.resolve("."); |
53 | 52 |
54 CompilerImpl(this.provider, api.CompilerOutput outputProvider, | 53 CompilerImpl(this.provider, api.CompilerOutput outputProvider, |
55 this.handler, api.CompilerOptions options) | 54 this.handler, CompilerOptions options) |
56 : super(options: options, outputProvider: outputProvider, | 55 : super(options: options, outputProvider: outputProvider, |
57 environment: new _Environment(options.environment)) { | 56 environment: new _Environment(options.environment)) { |
58 _Environment env = environment; | 57 _Environment env = environment; |
59 env.compiler = this; | 58 env.compiler = this; |
60 tasks.addAll([ | 59 tasks.addAll([ |
61 userHandlerTask = new GenericTask('Diagnostic handler', this), | 60 userHandlerTask = new GenericTask('Diagnostic handler', this), |
62 userProviderTask = new GenericTask('Input provider', this), | 61 userProviderTask = new GenericTask('Input provider', this), |
63 userPackagesDiscoveryTask = | 62 userPackagesDiscoveryTask = |
64 new GenericTask('Package discovery', this), | 63 new GenericTask('Package discovery', this), |
65 ]); | 64 ]); |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 } | 426 } |
428 } | 427 } |
429 | 428 |
430 /// For every 'dart:' library, a corresponding environment variable is set | 429 /// For every 'dart:' library, a corresponding environment variable is set |
431 /// to "true". The environment variable's name is the concatenation of | 430 /// to "true". The environment variable's name is the concatenation of |
432 /// this prefix and the name (without the 'dart:'. | 431 /// this prefix and the name (without the 'dart:'. |
433 /// | 432 /// |
434 /// For example 'dart:html' has the environment variable 'dart.library.html' set | 433 /// For example 'dart:html' has the environment variable 'dart.library.html' set |
435 /// to "true". | 434 /// to "true". |
436 const String _dartLibraryEnvironmentPrefix = 'dart.library.'; | 435 const String _dartLibraryEnvironmentPrefix = 'dart.library.'; |
OLD | NEW |