| 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'; |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 | 590 |
| 591 fromEnvironment(String name) { | 591 fromEnvironment(String name) { |
| 592 assert(invariant(NO_LOCATION_SPANNABLE, | 592 assert(invariant(NO_LOCATION_SPANNABLE, |
| 593 sdkLibraries != null, message: "setupSdk() has not been run")); | 593 sdkLibraries != null, message: "setupSdk() has not been run")); |
| 594 | 594 |
| 595 var result = environment[name]; | 595 var result = environment[name]; |
| 596 if (result != null || environment.containsKey(name)) return result; | 596 if (result != null || environment.containsKey(name)) return result; |
| 597 if (!name.startsWith(dartLibraryEnvironmentPrefix)) return null; | 597 if (!name.startsWith(dartLibraryEnvironmentPrefix)) return null; |
| 598 | 598 |
| 599 String libraryName = name.substring(dartLibraryEnvironmentPrefix.length); | 599 String libraryName = name.substring(dartLibraryEnvironmentPrefix.length); |
| 600 |
| 601 // Private libraries are not exposed to the users. |
| 602 if (libraryName.startsWith("_")) return null; |
| 603 |
| 600 if (sdkLibraries.containsKey(libraryName)) { | 604 if (sdkLibraries.containsKey(libraryName)) { |
| 601 // Dart2js always "supports" importing 'dart:mirrors' but will abort | 605 // Dart2js always "supports" importing 'dart:mirrors' but will abort |
| 602 // the compilation at a later point if the backend doesn't support | 606 // the compilation at a later point if the backend doesn't support |
| 603 // mirrors. In this case 'mirrors' should not be in the environment. | 607 // mirrors. In this case 'mirrors' should not be in the environment. |
| 604 if (name == dartLibraryEnvironmentPrefix + 'mirrors') { | 608 if (libraryName == 'mirrors') { |
| 605 return backend.supportsReflection ? "true" : null; | 609 return backend.supportsReflection ? "true" : null; |
| 606 } | 610 } |
| 607 return "true"; | 611 return "true"; |
| 608 } | 612 } |
| 609 return null; | 613 return null; |
| 610 } | 614 } |
| 611 | 615 |
| 612 Uri lookupLibraryUri(String libraryName) { | 616 Uri lookupLibraryUri(String libraryName) { |
| 613 assert(invariant(NO_LOCATION_SPANNABLE, | 617 assert(invariant(NO_LOCATION_SPANNABLE, |
| 614 sdkLibraries != null, message: "setupSdk() has not been run")); | 618 sdkLibraries != null, message: "setupSdk() has not been run")); |
| 615 return sdkLibraries[libraryName]; | 619 return sdkLibraries[libraryName]; |
| 616 } | 620 } |
| 617 | 621 |
| 618 Uri resolvePatchUri(String libraryName) { | 622 Uri resolvePatchUri(String libraryName) { |
| 619 return backend.resolvePatchUri(libraryName, platformConfigUri); | 623 return backend.resolvePatchUri(libraryName, platformConfigUri); |
| 620 } | 624 } |
| 621 } | 625 } |
| OLD | NEW |