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

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

Issue 1338783002: Show import chains for unsupported dart:* library imports. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Update cf. comments. Created 5 years, 3 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 | pkg/compiler/lib/src/compiler.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 ce3ec39b7a9d6a027fac88f5401e5c12bdf1c598..92f7ff6da8296b253dff9c662fb632692c2a189c 100644
--- a/pkg/compiler/lib/src/apiimpl.dart
+++ b/pkg/compiler/lib/src/apiimpl.dart
@@ -191,10 +191,13 @@ class Compiler extends leg.Compiler {
// TODO(johnniwinther): Merge better with [translateDartUri] when
// [scanBuiltinLibrary] is removed.
- String lookupLibraryPath(LibraryInfo info) {
+ String lookupLibraryPath(Uri uri, LibraryInfo info) {
if (info == null) return null;
if (!info.isDart2jsLibrary) return null;
- if (!allowedLibraryCategories.contains(info.category)) return null;
+ if (!allowedLibraryCategories.contains(info.category)) {
+ registerDisallowedLibraryUse(uri);
+ return null;
+ }
String path = info.dart2jsPath;
if (path == null) {
path = info.path;
@@ -316,7 +319,7 @@ class Compiler extends leg.Compiler {
Uri translateDartUri(elements.LibraryElement importingLibrary,
Uri resolvedUri, tree.Node node) {
LibraryInfo libraryInfo = lookupLibraryInfo(resolvedUri.path);
- String path = lookupLibraryPath(libraryInfo);
+ String path = lookupLibraryPath(resolvedUri, libraryInfo);
if (libraryInfo != null &&
libraryInfo.category == "Internal") {
bool allowInternalLibraryAccess = false;
@@ -344,8 +347,15 @@ class Compiler extends leg.Compiler {
}
}
if (path == null) {
- reportError(node, MessageKind.LIBRARY_NOT_FOUND,
- {'resolvedUri': resolvedUri});
+ if (libraryInfo == null) {
+ reportError(node, MessageKind.LIBRARY_NOT_FOUND,
+ {'resolvedUri': resolvedUri});
+ } else {
+ reportError(node, MessageKind.LIBRARY_NOT_SUPPORTED,
+ {'resolvedUri': resolvedUri});
+ }
+ // TODO(johnniwinther): Support signaling the error through the returned
+ // value.
return null;
}
if (resolvedUri.path == 'html' ||
« no previous file with comments | « no previous file | pkg/compiler/lib/src/compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698