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 26 matching lines...) Expand all Loading... |
37 ASSERT_IS_GIVEN_NAMED_ARGUMENTS, | 37 ASSERT_IS_GIVEN_NAMED_ARGUMENTS, |
38 ASSIGNING_FINAL_FIELD_IN_SUPER, | 38 ASSIGNING_FINAL_FIELD_IN_SUPER, |
39 ASSIGNING_METHOD, | 39 ASSIGNING_METHOD, |
40 ASSIGNING_METHOD_IN_SUPER, | 40 ASSIGNING_METHOD_IN_SUPER, |
41 ASSIGNING_TYPE, | 41 ASSIGNING_TYPE, |
42 ASYNC_AWAIT_NOT_SUPPORTED, | 42 ASYNC_AWAIT_NOT_SUPPORTED, |
43 ASYNC_KEYWORD_AS_IDENTIFIER, | 43 ASYNC_KEYWORD_AS_IDENTIFIER, |
44 ASYNC_MODIFIER_ON_ABSTRACT_METHOD, | 44 ASYNC_MODIFIER_ON_ABSTRACT_METHOD, |
45 ASYNC_MODIFIER_ON_CONSTRUCTOR, | 45 ASYNC_MODIFIER_ON_CONSTRUCTOR, |
46 ASYNC_MODIFIER_ON_SETTER, | 46 ASYNC_MODIFIER_ON_SETTER, |
| 47 AWAIT_FORIN_VOID_GENERIC, |
47 AWAIT_MEMBER_NOT_FOUND, | 48 AWAIT_MEMBER_NOT_FOUND, |
48 AWAIT_MEMBER_NOT_FOUND_IN_CLOSURE, | 49 AWAIT_MEMBER_NOT_FOUND_IN_CLOSURE, |
49 BAD_INPUT_CHARACTER, | 50 BAD_INPUT_CHARACTER, |
50 BEFORE_TOP_LEVEL, | 51 BEFORE_TOP_LEVEL, |
51 BINARY_OPERATOR_BAD_ARITY, | 52 BINARY_OPERATOR_BAD_ARITY, |
52 BODY_EXPECTED, | 53 BODY_EXPECTED, |
53 CANNOT_EXTEND, | 54 CANNOT_EXTEND, |
54 CANNOT_EXTEND_ENUM, | 55 CANNOT_EXTEND_ENUM, |
55 CANNOT_EXTEND_MALFORMED, | 56 CANNOT_EXTEND_MALFORMED, |
56 CANNOT_FIND_CONSTRUCTOR, | 57 CANNOT_FIND_CONSTRUCTOR, |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 EXPORT_BEFORE_PARTS, | 147 EXPORT_BEFORE_PARTS, |
147 EXTERNAL_WITH_BODY, | 148 EXTERNAL_WITH_BODY, |
148 EXTRA_CATCH_DECLARATION, | 149 EXTRA_CATCH_DECLARATION, |
149 EXTRA_FORMALS, | 150 EXTRA_FORMALS, |
150 EXTRANEOUS_MODIFIER, | 151 EXTRANEOUS_MODIFIER, |
151 EXTRANEOUS_MODIFIER_REPLACE, | 152 EXTRANEOUS_MODIFIER_REPLACE, |
152 FACTORY_REDIRECTION_IN_NON_FACTORY, | 153 FACTORY_REDIRECTION_IN_NON_FACTORY, |
153 FINAL_FUNCTION_TYPE_PARAMETER, | 154 FINAL_FUNCTION_TYPE_PARAMETER, |
154 FINAL_WITHOUT_INITIALIZER, | 155 FINAL_WITHOUT_INITIALIZER, |
155 FORIN_NOT_ASSIGNABLE, | 156 FORIN_NOT_ASSIGNABLE, |
| 157 FORIN_VOID_GENERIC, |
156 FORMAL_DECLARED_CONST, | 158 FORMAL_DECLARED_CONST, |
157 FORMAL_DECLARED_STATIC, | 159 FORMAL_DECLARED_STATIC, |
158 FUNCTION_TYPE_FORMAL_WITH_DEFAULT, | 160 FUNCTION_TYPE_FORMAL_WITH_DEFAULT, |
159 FUNCTION_WITH_INITIALIZER, | 161 FUNCTION_WITH_INITIALIZER, |
160 GENERIC, | 162 GENERIC, |
161 GETTER_MISMATCH, | 163 GETTER_MISMATCH, |
162 UNDEFINED_INSTANCE_GETTER_BUT_SETTER, | 164 UNDEFINED_INSTANCE_GETTER_BUT_SETTER, |
163 HEX_DIGIT_EXPECTED, | 165 HEX_DIGIT_EXPECTED, |
164 HIDDEN_HINTS, | 166 HIDDEN_HINTS, |
165 HIDDEN_IMPLICIT_IMPORT, | 167 HIDDEN_IMPLICIT_IMPORT, |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 /// 4 of the guide lines for error messages in the beginning of the file. | 469 /// 4 of the guide lines for error messages in the beginning of the file. |
468 MessageKind.GENERIC: | 470 MessageKind.GENERIC: |
469 const MessageTemplate(MessageKind.GENERIC, '#{text}'), | 471 const MessageTemplate(MessageKind.GENERIC, '#{text}'), |
470 | 472 |
471 MessageKind.VOID_EXPRESSION: const MessageTemplate( | 473 MessageKind.VOID_EXPRESSION: const MessageTemplate( |
472 MessageKind.VOID_EXPRESSION, "Expression does not yield a value."), | 474 MessageKind.VOID_EXPRESSION, "Expression does not yield a value."), |
473 | 475 |
474 MessageKind.VOID_VARIABLE: const MessageTemplate( | 476 MessageKind.VOID_VARIABLE: const MessageTemplate( |
475 MessageKind.VOID_VARIABLE, "Variable cannot be of type void."), | 477 MessageKind.VOID_VARIABLE, "Variable cannot be of type void."), |
476 | 478 |
| 479 MessageKind.FORIN_VOID_GENERIC: const MessageTemplate( |
| 480 MessageKind.FORIN_VOID_GENERIC, |
| 481 "Generic type of Iterable cannot be of type void.", |
| 482 examples: const [ |
| 483 """ |
| 484 main() { |
| 485 for (var x in new List<void>()) { |
| 486 } |
| 487 } |
| 488 """ |
| 489 ]), |
| 490 |
477 MessageKind.RETURN_VALUE_IN_VOID: const MessageTemplate( | 491 MessageKind.RETURN_VALUE_IN_VOID: const MessageTemplate( |
478 MessageKind.RETURN_VALUE_IN_VOID, | 492 MessageKind.RETURN_VALUE_IN_VOID, |
479 "Cannot return value from void function."), | 493 "Cannot return value from void function."), |
480 | 494 |
481 MessageKind.RETURN_NOTHING: const MessageTemplate( | 495 MessageKind.RETURN_NOTHING: const MessageTemplate( |
482 MessageKind.RETURN_NOTHING, | 496 MessageKind.RETURN_NOTHING, |
483 "Value of type '#{returnType}' expected."), | 497 "Value of type '#{returnType}' expected."), |
484 | 498 |
485 MessageKind.MISSING_ARGUMENT: const MessageTemplate( | 499 MessageKind.MISSING_ARGUMENT: const MessageTemplate( |
486 MessageKind.MISSING_ARGUMENT, | 500 MessageKind.MISSING_ARGUMENT, |
487 "Missing argument of type '#{argumentType}'."), | 501 "Missing argument of type '#{argumentType}'."), |
488 | 502 |
489 MessageKind.ADDITIONAL_ARGUMENT: const MessageTemplate( | 503 MessageKind.ADDITIONAL_ARGUMENT: const MessageTemplate( |
490 MessageKind.ADDITIONAL_ARGUMENT, "Additional argument."), | 504 MessageKind.ADDITIONAL_ARGUMENT, "Additional argument."), |
491 | 505 |
492 MessageKind.NAMED_ARGUMENT_NOT_FOUND: const MessageTemplate( | 506 MessageKind.NAMED_ARGUMENT_NOT_FOUND: const MessageTemplate( |
493 MessageKind.NAMED_ARGUMENT_NOT_FOUND, | 507 MessageKind.NAMED_ARGUMENT_NOT_FOUND, |
494 "No named argument '#{argumentName}' found on method."), | 508 "No named argument '#{argumentName}' found on method."), |
495 | 509 |
| 510 MessageKind.AWAIT_FORIN_VOID_GENERIC: const MessageTemplate( |
| 511 MessageKind.AWAIT_FORIN_VOID_GENERIC, |
| 512 "Generic type of Stream cannot be of type void.", |
| 513 examples: const [ |
| 514 """ |
| 515 import 'dart:async'; |
| 516 main() async { |
| 517 await for (var x in new StreamView<void>(null)) { |
| 518 } |
| 519 } |
| 520 """ |
| 521 ]), |
| 522 |
496 MessageKind.AWAIT_MEMBER_NOT_FOUND: const MessageTemplate( | 523 MessageKind.AWAIT_MEMBER_NOT_FOUND: const MessageTemplate( |
497 MessageKind.AWAIT_MEMBER_NOT_FOUND, | 524 MessageKind.AWAIT_MEMBER_NOT_FOUND, |
498 "No member named 'await' in class '#{className}'.", | 525 "No member named 'await' in class '#{className}'.", |
499 howToFix: "Did you mean to add the 'async' marker " | 526 howToFix: "Did you mean to add the 'async' marker " |
500 "to '#{functionName}'?", | 527 "to '#{functionName}'?", |
501 examples: const [ | 528 examples: const [ |
502 """ | 529 """ |
503 class A { | 530 class A { |
504 m() => await -3; | 531 m() => await -3; |
505 } | 532 } |
(...skipping 3286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3792 static String convertToString(value) { | 3819 static String convertToString(value) { |
3793 if (value is ErrorToken) { | 3820 if (value is ErrorToken) { |
3794 // Shouldn't happen. | 3821 // Shouldn't happen. |
3795 return value.assertionMessage; | 3822 return value.assertionMessage; |
3796 } else if (value is Token) { | 3823 } else if (value is Token) { |
3797 value = value.lexeme; | 3824 value = value.lexeme; |
3798 } | 3825 } |
3799 return '$value'; | 3826 return '$value'; |
3800 } | 3827 } |
3801 } | 3828 } |
OLD | NEW |