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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 EXTRA_CATCH_DECLARATION, | 148 EXTRA_CATCH_DECLARATION, |
149 EXTRA_FORMALS, | 149 EXTRA_FORMALS, |
150 EXTRANEOUS_MODIFIER, | 150 EXTRANEOUS_MODIFIER, |
151 EXTRANEOUS_MODIFIER_REPLACE, | 151 EXTRANEOUS_MODIFIER_REPLACE, |
152 FACTORY_REDIRECTION_IN_NON_FACTORY, | 152 FACTORY_REDIRECTION_IN_NON_FACTORY, |
153 FINAL_FUNCTION_TYPE_PARAMETER, | 153 FINAL_FUNCTION_TYPE_PARAMETER, |
154 FINAL_WITHOUT_INITIALIZER, | 154 FINAL_WITHOUT_INITIALIZER, |
155 FORIN_NOT_ASSIGNABLE, | 155 FORIN_NOT_ASSIGNABLE, |
156 FORMAL_DECLARED_CONST, | 156 FORMAL_DECLARED_CONST, |
157 FORMAL_DECLARED_STATIC, | 157 FORMAL_DECLARED_STATIC, |
| 158 FROM_ENVIRONMENT_MUST_BE_CONST, |
158 FUNCTION_TYPE_FORMAL_WITH_DEFAULT, | 159 FUNCTION_TYPE_FORMAL_WITH_DEFAULT, |
159 FUNCTION_WITH_INITIALIZER, | 160 FUNCTION_WITH_INITIALIZER, |
160 GENERIC, | 161 GENERIC, |
161 GETTER_MISMATCH, | 162 GETTER_MISMATCH, |
162 UNDEFINED_INSTANCE_GETTER_BUT_SETTER, | 163 UNDEFINED_INSTANCE_GETTER_BUT_SETTER, |
163 HEX_DIGIT_EXPECTED, | 164 HEX_DIGIT_EXPECTED, |
164 HIDDEN_HINTS, | 165 HIDDEN_HINTS, |
165 HIDDEN_IMPLICIT_IMPORT, | 166 HIDDEN_IMPLICIT_IMPORT, |
166 HIDDEN_IMPORT, | 167 HIDDEN_IMPORT, |
167 HIDDEN_WARNINGS, | 168 HIDDEN_WARNINGS, |
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 const MessageTemplate( | 1072 const MessageTemplate( |
1072 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD, | 1073 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD, |
1073 "This non-final field prevents using const constructors."), | 1074 "This non-final field prevents using const constructors."), |
1074 | 1075 |
1075 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR: | 1076 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR: |
1076 const MessageTemplate( | 1077 const MessageTemplate( |
1077 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR, | 1078 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR, |
1078 "This const constructor is not allowed due to " | 1079 "This const constructor is not allowed due to " |
1079 "non-final fields."), | 1080 "non-final fields."), |
1080 | 1081 |
| 1082 MessageKind.FROM_ENVIRONMENT_MUST_BE_CONST: const MessageTemplate( |
| 1083 MessageKind.FROM_ENVIRONMENT_MUST_BE_CONST, |
| 1084 "#{className}.fromEnvironment can only be used as a " |
| 1085 "const constructor.", |
| 1086 howToFix: "Try replacing `new` with `const`.", |
| 1087 examples: const ["main() { new bool.fromEnvironment('X'); }"]), |
| 1088 |
1081 MessageKind.INITIALIZING_FORMAL_NOT_ALLOWED: const MessageTemplate( | 1089 MessageKind.INITIALIZING_FORMAL_NOT_ALLOWED: const MessageTemplate( |
1082 MessageKind.INITIALIZING_FORMAL_NOT_ALLOWED, | 1090 MessageKind.INITIALIZING_FORMAL_NOT_ALLOWED, |
1083 "Initializing formal parameter only allowed in generative " | 1091 "Initializing formal parameter only allowed in generative " |
1084 "constructor."), | 1092 "constructor."), |
1085 | 1093 |
1086 MessageKind.INVALID_PARAMETER: const MessageTemplate( | 1094 MessageKind.INVALID_PARAMETER: const MessageTemplate( |
1087 MessageKind.INVALID_PARAMETER, "Cannot resolve parameter."), | 1095 MessageKind.INVALID_PARAMETER, "Cannot resolve parameter."), |
1088 | 1096 |
1089 MessageKind.NOT_INSTANCE_FIELD: const MessageTemplate( | 1097 MessageKind.NOT_INSTANCE_FIELD: const MessageTemplate( |
1090 MessageKind.NOT_INSTANCE_FIELD, | 1098 MessageKind.NOT_INSTANCE_FIELD, |
(...skipping 2701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3792 static String convertToString(value) { | 3800 static String convertToString(value) { |
3793 if (value is ErrorToken) { | 3801 if (value is ErrorToken) { |
3794 // Shouldn't happen. | 3802 // Shouldn't happen. |
3795 return value.assertionMessage; | 3803 return value.assertionMessage; |
3796 } else if (value is Token) { | 3804 } else if (value is Token) { |
3797 value = value.lexeme; | 3805 value = value.lexeme; |
3798 } | 3806 } |
3799 return '$value'; | 3807 return '$value'; |
3800 } | 3808 } |
3801 } | 3809 } |
OLD | NEW |