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

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: 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
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 b55b0260f8c9119bd7be78b587d3f1e44eabf6f2..5bebf7a6e7a49818f6e03309e31aaaf9c9071d25 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,39 @@ 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': """
ahe 2013/09/17 10:47:18 I think these examples would be easier to read if
Johnni Winther 2013/09/18 06:14:11 Done.
+import 'dart:async'; // This imports a class Future.
+import 'future.dart';
+
+void main() {}""", 'future.dart': """
ahe 2013/09/17 10:47:18 This is somewhat hard to read. Also, please add a
Johnni Winther 2013/09/18 06:14:11 Done.
+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}".');

Powered by Google App Engine
This is Rietveld 408576698