Chromium Code Reviews| 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..29c7659a9567bf1680bc89d9767a7dd0e9845548 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 declartions.", |
|
Johnni Winther
2014/12/18 10:05:11
'declartions' -> 'declarations'.
ahe
2014/12/18 11:05:13
Done.
|
| + 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. |
| ////////////////////////////////////////////////////////////////////////////// |