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

Unified Diff: sdk/lib/_internal/compiler/implementation/warnings.dart

Issue 23684057: Support new import rules. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 7 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 | « sdk/lib/_internal/compiler/implementation/library_loader.dart ('k') | tests/co19/co19-co19.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/warnings.dart
diff --git a/sdk/lib/_internal/compiler/implementation/warnings.dart b/sdk/lib/_internal/compiler/implementation/warnings.dart
index 53f5e062c02676b4eff4c9b036bb93f713b7233e..93a1a04519898ba330aa159e9f3eae78e42aa10c 100644
--- a/sdk/lib/_internal/compiler/implementation/warnings.dart
+++ b/sdk/lib/_internal/compiler/implementation/warnings.dart
@@ -75,9 +75,15 @@ class MessageKind {
/// Should describe how to fix the problem. Elided when using --terse option.
final String howToFix;
- /// Examples will be checked by
- /// tests/compiler/dart2js/message_kind_test.dart.
- final List<String> examples;
+ /**
+ * Examples will be checked by
+ * tests/compiler/dart2js/message_kind_test.dart.
+ *
+ * An example is either a String containing the example source code or a Map
+ * from filenames to source code. In the latter case, the filename for the
+ * main library code must be 'main.dart'.
+ */
+ final List examples;
const MessageKind(this.template, {this.howToFix, this.examples});
@@ -188,6 +194,59 @@ class MessageKind {
error: const MessageKind('Error: Duplicate import of "#{name}".'),
warning: const MessageKind('Warning: Duplicate import of "#{name}".'));
+ static const MessageKind HIDDEN_IMPORT = const MessageKind(
+ "Warning: '#{name}' from library '#{hiddenUri}' by '#{name}' "
+ "from library '#{hidingUri}'.",
+ howToFix: "Try adding 'hide #{name}' to the import of '#{hiddenUri}'.",
+ examples: const [
+ const {
+'main.dart':
+"""
+import 'dart:async'; // This imports a class Future.
+import 'future.dart';
+
+void main() {}""",
+
+'future.dart':
+"""
+library future;
+
+class Future {}"""},
+
+ const {
+'main.dart':
+"""
+import 'future.dart';
+import 'dart:async'; // This imports a class Future.
+
+void main() {}""",
+
+'future.dart':
+"""
+library future;
+
+class Future {}"""},
+
+ const {
+'main.dart':
+"""
+import 'export.dart';
+import 'dart:async'; // This imports a class Future.
+
+void main() {}""",
+
+'future.dart':
+"""
+library future;
+
+class Future {}""",
+
+'export.dart':
+"""
+library export;
+
+export 'future.dart';"""}]);
+
static const MessageKind DUPLICATE_EXPORT = const MessageKind(
'Error: Duplicate export of "#{name}".');
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/library_loader.dart ('k') | tests/co19/co19-co19.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698