| 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; |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 resolutionInput, sourceFile.slowText()); | 215 resolutionInput, sourceFile.slowText()); |
| 216 }); | 216 }); |
| 217 }); | 217 }); |
| 218 } | 218 } |
| 219 if (resolvedUriTranslator.isNotSet) { | 219 if (resolvedUriTranslator.isNotSet) { |
| 220 future = future.then((_) { | 220 future = future.then((_) { |
| 221 return platform_configuration | 221 return platform_configuration |
| 222 .load(options.platformConfigUri, provider) | 222 .load(options.platformConfigUri, provider) |
| 223 .then((Map<String, Uri> mapping) { | 223 .then((Map<String, Uri> mapping) { |
| 224 resolvedUriTranslator.resolvedUriTranslator = | 224 resolvedUriTranslator.resolvedUriTranslator = |
| 225 new ResolvedUriTranslator(mapping, reporter); | 225 new ResolvedUriTranslator( |
| 226 mapping, reporter, options.platformConfigUri); |
| 226 }); | 227 }); |
| 227 }); | 228 }); |
| 228 } | 229 } |
| 229 // TODO(johnniwinther): This does not apply anymore. | 230 // TODO(johnniwinther): This does not apply anymore. |
| 230 // The incremental compiler sets up the sdk before run. | 231 // The incremental compiler sets up the sdk before run. |
| 231 // Therefore this will be called a second time. | 232 // Therefore this will be called a second time. |
| 232 return future; | 233 return future; |
| 233 } | 234 } |
| 234 | 235 |
| 235 Future<bool> run(Uri uri) { | 236 Future<bool> run(Uri uri) { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 Uri libraryUri = compiler.resolvedUriTranslator.sdkLibraries[libraryName]; | 386 Uri libraryUri = compiler.resolvedUriTranslator.sdkLibraries[libraryName]; |
| 386 if (libraryUri != null && libraryUri.scheme != "unsupported") { | 387 if (libraryUri != null && libraryUri.scheme != "unsupported") { |
| 387 // Dart2js always "supports" importing 'dart:mirrors' but will abort | 388 // Dart2js always "supports" importing 'dart:mirrors' but will abort |
| 388 // the compilation at a later point if the backend doesn't support | 389 // the compilation at a later point if the backend doesn't support |
| 389 // mirrors. In this case 'mirrors' should not be in the environment. | 390 // mirrors. In this case 'mirrors' should not be in the environment. |
| 390 if (libraryName == 'mirrors') { | 391 if (libraryName == 'mirrors') { |
| 391 return compiler.backend.supportsReflection ? "true" : null; | 392 return compiler.backend.supportsReflection ? "true" : null; |
| 392 } | 393 } |
| 393 return "true"; | 394 return "true"; |
| 394 } | 395 } |
| 396 |
| 397 // Note: we return null on `dart:io` here, even if we allow users to |
| 398 // unconditionally import it. |
| 399 // |
| 400 // In the past it was invalid to import `dart:io` for client apps. We just |
| 401 // made it valid to import it as a stopgap measure to support packages like |
| 402 // `http`. This is temporary until we support config-imports in the |
| 403 // language. |
| 404 // |
| 405 // Because it is meant to be temporary and because the returned `dart:io` |
| 406 // implementation will throw on most APIs, we still preserve that |
| 407 // when compiling client apps the `dart:io` library is technically not |
| 408 // supported, and so `const bool.fromEnvironment(dart.library.io)` is false. |
| 395 return null; | 409 return null; |
| 396 } | 410 } |
| 397 } | 411 } |
| 398 | 412 |
| 399 /// For every 'dart:' library, a corresponding environment variable is set | 413 /// For every 'dart:' library, a corresponding environment variable is set |
| 400 /// to "true". The environment variable's name is the concatenation of | 414 /// to "true". The environment variable's name is the concatenation of |
| 401 /// this prefix and the name (without the 'dart:'. | 415 /// this prefix and the name (without the 'dart:'. |
| 402 /// | 416 /// |
| 403 /// For example 'dart:html' has the environment variable 'dart.library.html' set | 417 /// For example 'dart:html' has the environment variable 'dart.library.html' set |
| 404 /// to "true". | 418 /// to "true". |
| 405 const String _dartLibraryEnvironmentPrefix = 'dart.library.'; | 419 const String _dartLibraryEnvironmentPrefix = 'dart.library.'; |
| OLD | NEW |