Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1570)

Unified Diff: pkg/compiler/lib/src/apiimpl.dart

Issue 1674613002: Don't expose private libraries with dart.library.X. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Remove debug print. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/language/library_env_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/apiimpl.dart
diff --git a/pkg/compiler/lib/src/apiimpl.dart b/pkg/compiler/lib/src/apiimpl.dart
index e84777f59200c13be55ae623671dc2bbc1e23be2..73bbc60d3f11156bb00eab50ce608adc1c7257f6 100644
--- a/pkg/compiler/lib/src/apiimpl.dart
+++ b/pkg/compiler/lib/src/apiimpl.dart
@@ -597,11 +597,15 @@ class CompilerImpl extends Compiler {
if (!name.startsWith(dartLibraryEnvironmentPrefix)) return null;
String libraryName = name.substring(dartLibraryEnvironmentPrefix.length);
+
+ // Private libraries are not exposed to the users.
+ if (libraryName.startsWith("_")) return null;
+
if (sdkLibraries.containsKey(libraryName)) {
// Dart2js always "supports" importing 'dart:mirrors' but will abort
// the compilation at a later point if the backend doesn't support
// mirrors. In this case 'mirrors' should not be in the environment.
- if (name == dartLibraryEnvironmentPrefix + 'mirrors') {
+ if (libraryName == 'mirrors') {
return backend.supportsReflection ? "true" : null;
}
return "true";
« no previous file with comments | « no previous file | tests/language/library_env_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698