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

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: Cleanup. 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') | pkg/compiler/lib/src/compiler.dart » ('J')
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..17912f694b06d60f11dc095766696488700a61a5 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,13 @@ class Compiler extends leg.Compiler {
}
}
if (path == null) {
- reportError(node, MessageKind.LIBRARY_NOT_FOUND,
- {'resolvedUri': resolvedUri});
+ if (libraryInfo == null) {
sigurdm 2015/09/14 12:34:57 It would be nice to have another way than just ret
Johnni Winther 2015/09/14 13:23:39 Good point. Adding a TODO.
+ reportError(node, MessageKind.LIBRARY_NOT_FOUND,
+ {'resolvedUri': resolvedUri});
+ } else {
+ reportError(node, MessageKind.LIBRARY_NOT_SUPPORTED,
+ {'resolvedUri': resolvedUri});
+ }
return null;
}
if (resolvedUri.path == 'html' ||
« no previous file with comments | « no previous file | pkg/compiler/lib/src/compiler.dart » ('j') | pkg/compiler/lib/src/compiler.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698