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

Unified Diff: pkg/kernel/lib/target/targets.dart

Issue 2992073002: FE: let targets override whether imports to internal platform libraries (dart:_foo) are allowed. (Closed)
Patch Set: Created 3 years, 5 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 | « pkg/front_end/lib/src/fasta/loader.dart ('k') | tests/compiler/dart2js_native/dart2js_native.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/lib/target/targets.dart
diff --git a/pkg/kernel/lib/target/targets.dart b/pkg/kernel/lib/target/targets.dart
index 3227f012c7b72a3ae7ef275653378886a0a37049..91671416072c3d03e01fbef3d7a1d8e2006d604a 100644
--- a/pkg/kernel/lib/target/targets.dart
+++ b/pkg/kernel/lib/target/targets.dart
@@ -129,6 +129,15 @@ abstract class Target {
bool mayDefineRestrictedType(Uri uri) =>
uri.scheme == 'dart' && uri.path == 'core';
+ /// Whether a library is allowed to import a platform private library.
+ ///
+ /// By default only `dart:*` libraries are allowed. May be overriden for
+ /// testing purposes.
+ bool allowPlatformPrivateLibraryAccess(Uri importer, Uri imported) =>
+ imported.scheme != "dart" ||
+ !imported.path.startsWith("_") ||
+ importer.scheme == "dart";
+
/// Whether the `native` language extension is supported within [library].
///
/// The `native` language extension is not part of the language specification,
« no previous file with comments | « pkg/front_end/lib/src/fasta/loader.dart ('k') | tests/compiler/dart2js_native/dart2js_native.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698