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

Unified Diff: pkg/compiler/lib/src/diagnostics/messages.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 | « pkg/compiler/lib/src/compiler.dart ('k') | pkg/compiler/lib/src/js_backend/backend.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/diagnostics/messages.dart
diff --git a/pkg/compiler/lib/src/diagnostics/messages.dart b/pkg/compiler/lib/src/diagnostics/messages.dart
index df778da9ea689b372c0737e238577ed5d53a6557..8fabdf8e91de92285ee11fdaf233fa78b8fb7efa 100644
--- a/pkg/compiler/lib/src/diagnostics/messages.dart
+++ b/pkg/compiler/lib/src/diagnostics/messages.dart
@@ -166,6 +166,7 @@ enum MessageKind {
DEFERRED_TYPE_ANNOTATION,
DEPRECATED_TYPEDEF_MIXIN_SYNTAX,
DIRECTLY_THROWING_NSM,
+ DISALLOWED_LIBRARY_IMPORT,
DUPLICATE_DEFINITION,
DUPLICATE_EXPORT,
DUPLICATE_EXPORT_CONT,
@@ -273,6 +274,7 @@ enum MessageKind {
INVALID_USE_OF_SUPER,
LIBRARY_NAME_MISMATCH,
LIBRARY_NOT_FOUND,
+ LIBRARY_NOT_SUPPORTED,
LIBRARY_TAG_MUST_BE_FIRST,
MAIN_NOT_A_FUNCTION,
MAIN_WITH_EXTRA_PARAMETER,
@@ -2095,6 +2097,20 @@ main() => A.A = 1;
const MessageTemplate(MessageKind.LIBRARY_NOT_FOUND,
"Library not found '#{resolvedUri}'."),
+ MessageKind.LIBRARY_NOT_SUPPORTED:
+ const MessageTemplate(MessageKind.LIBRARY_NOT_SUPPORTED,
+ "Library not supported '#{resolvedUri}'.",
+ howToFix: "Try removing the dependency or enabling support using "
+ "the '--categories' option.",
+ examples: const [/*
+ """
+ import 'dart:io';
+ main() {}
+ """
+ */]),
+ // TODO(johnniwinther): Enable example when message_kind_test.dart
+ // supports library loader callbacks.
+
MessageKind.UNSUPPORTED_EQ_EQ_EQ:
const MessageTemplate(MessageKind.UNSUPPORTED_EQ_EQ_EQ,
"'===' is not an operator. "
@@ -3274,6 +3290,14 @@ $IMPORT_EXPERIMENTAL_MIRRORS_PADDING#{importChain}
****************************************************************
'''),
+ MessageKind.DISALLOWED_LIBRARY_IMPORT:
+ const MessageTemplate(MessageKind.DISALLOWED_LIBRARY_IMPORT, '''
+Your app imports the unsupported library '#{uri}' via:
+''''''
+$DISALLOWED_LIBRARY_IMPORT_PADDING#{importChain}
+
+Use the --categories option to support import of '#{uri}'.
+'''),
MessageKind.MIRRORS_LIBRARY_NOT_SUPPORT_BY_BACKEND:
const MessageTemplate(
@@ -3314,8 +3338,14 @@ $IMPORT_EXPERIMENTAL_MIRRORS_PADDING#{importChain}
}; // End of TEMPLATES.
+ /// Padding used before and between import chains in the message for
+ /// [MessageKind.IMPORT_EXPERIMENTAL_MIRRORS].
static const String IMPORT_EXPERIMENTAL_MIRRORS_PADDING = '\n* ';
+ /// Padding used before and between import chains in the message for
+ /// [MessageKind.DISALLOWED_LIBRARY_IMPORT].
+ static const String DISALLOWED_LIBRARY_IMPORT_PADDING = '\n ';
+
toString() => template;
Message message([Map arguments = const {}, bool terse = false]) {
« no previous file with comments | « pkg/compiler/lib/src/compiler.dart ('k') | pkg/compiler/lib/src/js_backend/backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698