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

Unified Diff: runtime/vm/parser.cc

Issue 1185733003: Fix accessing dart:_ libraries via exports. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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/export_private_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 0307c908c9111041103b55eab058e4c044f9e85e..8491a6894a63ae267a5dcdc418e3b79789e710bb 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -5775,14 +5775,15 @@ void Parser::ParseLibraryImportExport(intptr_t metadata_pos) {
ns.AddMetadata(metadata_pos, current_class());
}
+ // Ensure that private dart:_ libraries are only imported into dart:
+ // libraries, including indirectly through exports.
+ const String& lib_url = String::Handle(Z, library_.url());
+ if (canon_url.StartsWith(Symbols::DartSchemePrivate()) &&
+ !lib_url.StartsWith(Symbols::DartScheme())) {
+ ReportError(import_pos, "private library is not accessible");
+ }
+
if (is_import) {
- // Ensure that private dart:_ libraries are only imported into dart:
- // libraries.
- const String& lib_url = String::Handle(Z, library_.url());
- if (canon_url.StartsWith(Symbols::DartSchemePrivate()) &&
- !lib_url.StartsWith(Symbols::DartScheme())) {
- ReportError(import_pos, "private library is not accessible");
- }
if (prefix.IsNull() || (prefix.Length() == 0)) {
ASSERT(!is_deferred_import);
library_.AddImport(ns);
« no previous file with comments | « no previous file | tests/language/export_private_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698