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