OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /// The messages in this file should follow the [Guide for Writing | 5 /// The messages in this file should follow the [Guide for Writing |
6 /// Diagnostics](../../../../front_end/lib/src/fasta/diagnostics.md). | 6 /// Diagnostics](../../../../front_end/lib/src/fasta/diagnostics.md). |
7 /// | 7 /// |
8 /// Other things to keep in mind: | 8 /// Other things to keep in mind: |
9 /// | 9 /// |
10 /// An INFO message should always be preceded by a non-INFO message, and the | 10 /// An INFO message should always be preceded by a non-INFO message, and the |
(...skipping 2016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2027 'part.dart': """ | 2027 'part.dart': """ |
2028 part of lib.bar; | 2028 part of lib.bar; |
2029 """ | 2029 """ |
2030 } | 2030 } |
2031 ]), | 2031 ]), |
2032 | 2032 |
2033 MessageKind.LIBRARY_URI_MISMATCH: const MessageTemplate( | 2033 MessageKind.LIBRARY_URI_MISMATCH: const MessageTemplate( |
2034 MessageKind.LIBRARY_URI_MISMATCH, | 2034 MessageKind.LIBRARY_URI_MISMATCH, |
2035 "Expected URI of library '#{libraryUri}'.", | 2035 "Expected URI of library '#{libraryUri}'.", |
2036 howToFix: "Try changing the directive to 'part of " | 2036 howToFix: "Try changing the directive to 'part of " |
2037 "\"#{libraryUri}\";'.", | 2037 "\"#{libraryUri}\";'.", |
2038 examples: const [ | 2038 examples: const [ |
2039 const { | 2039 const { |
2040 'main.dart': """ | 2040 'main.dart': """ |
2041 library lib.foo; | 2041 library lib.foo; |
2042 | 2042 |
2043 part 'part.dart'; | 2043 part 'part.dart'; |
2044 | 2044 |
2045 main() {} | 2045 main() {} |
2046 """, | 2046 """, |
2047 'part.dart': """ | 2047 'part.dart': """ |
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3287 MessageKind.HIDDEN_HINTS: const MessageTemplate( | 3287 MessageKind.HIDDEN_HINTS: const MessageTemplate( |
3288 MessageKind.HIDDEN_HINTS, "#{hints} hint(s) suppressed in #{uri}."), | 3288 MessageKind.HIDDEN_HINTS, "#{hints} hint(s) suppressed in #{uri}."), |
3289 | 3289 |
3290 MessageKind.PREAMBLE: const MessageTemplate( | 3290 MessageKind.PREAMBLE: const MessageTemplate( |
3291 MessageKind.PREAMBLE, | 3291 MessageKind.PREAMBLE, |
3292 "When run on the command-line, the compiled output might" | 3292 "When run on the command-line, the compiled output might" |
3293 " require a preamble file located in:\n" | 3293 " require a preamble file located in:\n" |
3294 " <sdk>/lib/_internal/js_runtime/lib/preambles."), | 3294 " <sdk>/lib/_internal/js_runtime/lib/preambles."), |
3295 | 3295 |
3296 MessageKind.INVALID_INLINE_FUNCTION_TYPE: const MessageTemplate( | 3296 MessageKind.INVALID_INLINE_FUNCTION_TYPE: const MessageTemplate( |
3297 MessageKind.INVALID_INLINE_FUNCTION_TYPE, | 3297 MessageKind.INVALID_INLINE_FUNCTION_TYPE, |
3298 "Invalid inline function type.", | 3298 "Invalid inline function type.", |
3299 howToFix: "Try changing the inline function type (as in 'int f()') to" | 3299 howToFix: "Try changing the inline function type (as in 'int f()') to" |
3300 " a prefixed function type using the `Function` keyword (as in " | 3300 " a prefixed function type using the `Function` keyword (as in " |
3301 "'int Function() f').", | 3301 "'int Function() f').", |
3302 examples: | 3302 examples: const [ |
3303 const ["typedef F = Function(int f(String x)); main() { F f; }"], | 3303 "typedef F = Function(int f(String x)); main() { F f; }" |
| 3304 ], |
3304 ), | 3305 ), |
3305 | 3306 |
3306 MessageKind.INVALID_SYNC_MODIFIER: const MessageTemplate( | 3307 MessageKind.INVALID_SYNC_MODIFIER: const MessageTemplate( |
3307 MessageKind.INVALID_SYNC_MODIFIER, "Invalid modifier 'sync'.", | 3308 MessageKind.INVALID_SYNC_MODIFIER, "Invalid modifier 'sync'.", |
3308 howToFix: "Try replacing 'sync' with 'sync*'.", | 3309 howToFix: "Try replacing 'sync' with 'sync*'.", |
3309 examples: const ["main() sync {}"]), | 3310 examples: const ["main() sync {}"]), |
3310 | 3311 |
3311 MessageKind.INVALID_AWAIT_FOR: const MessageTemplate( | 3312 MessageKind.INVALID_AWAIT_FOR: const MessageTemplate( |
3312 MessageKind.INVALID_AWAIT_FOR, | 3313 MessageKind.INVALID_AWAIT_FOR, |
3313 "'await' is only supported on for-in loops.", | 3314 "'await' is only supported on for-in loops.", |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3791 static String convertToString(value) { | 3792 static String convertToString(value) { |
3792 if (value is ErrorToken) { | 3793 if (value is ErrorToken) { |
3793 // Shouldn't happen. | 3794 // Shouldn't happen. |
3794 return value.assertionMessage; | 3795 return value.assertionMessage; |
3795 } else if (value is Token) { | 3796 } else if (value is Token) { |
3796 value = value.lexeme; | 3797 value = value.lexeme; |
3797 } | 3798 } |
3798 return '$value'; | 3799 return '$value'; |
3799 } | 3800 } |
3800 } | 3801 } |
OLD | NEW |