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

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

Issue 811583004: Recover from incorrectly ordered library tags. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Typo Created 6 years 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 | « dart/pkg/compiler/lib/src/library_loader.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/pkg/compiler/lib/src/warnings.dart
diff --git a/dart/pkg/compiler/lib/src/warnings.dart b/dart/pkg/compiler/lib/src/warnings.dart
index f3e7cc16ccd9e51385463062d94db3271a75028f..020ead1306a4aa96c866305f6c7199fe1f49326e 100644
--- a/dart/pkg/compiler/lib/src/warnings.dart
+++ b/dart/pkg/compiler/lib/src/warnings.dart
@@ -2178,6 +2178,66 @@ import 'dart-ext:main';
main() {}
"""]);
+ static const MessageKind LIBRARY_TAG_MUST_BE_FIRST = const MessageKind(
+ "The library declaration should come before other declarations.",
+ howToFix: "Try moving the declaration to the top of the file.",
+ examples: const [
+"""
+import 'dart:core';
+library foo;
+main() {}
+""",
+ ]);
+
+ static const MessageKind ONLY_ONE_LIBRARY_TAG = const MessageKind(
+ "There can only be one library declaration.",
+ howToFix: "Try removing all other library declarations.",
+ examples: const [
+"""
+library foo;
+library bar;
+main() {}
+""",
+"""
+library foo;
+import 'dart:core';
+library bar;
+main() {}
+""",
+ ]);
+
+ static const MessageKind IMPORT_BEFORE_PARTS = const MessageKind(
+ "Import declarations should come before parts.",
+ howToFix: "Try moving this import further up in the file.",
+ examples: const [
+ const <String, String>{
+ 'main.dart': """
+library test.main;
+part 'part.dart';
+import 'dart:core';
+main() {}
+""",
+ 'part.dart': """
+part of test.main;
+""",
+ }]);
+
+ static const MessageKind EXPORT_BEFORE_PARTS = const MessageKind(
+ "Export declarations should come before parts.",
+ howToFix: "Try moving this export further up in the file.",
+ examples: const [
+ const <String, String>{
+ 'main.dart': """
+library test.main;
+part 'part.dart';
+export 'dart:core';
+main() {}
+""",
+ 'part.dart': """
+part of test.main;
+""",
+ }]);
+
//////////////////////////////////////////////////////////////////////////////
// Patch errors start.
//////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « dart/pkg/compiler/lib/src/library_loader.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698