OLD | NEW |
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 library fletchc.diagnostic; | 5 library dartino_compiler.diagnostic; |
6 | 6 |
7 import 'messages.dart' show | 7 import 'messages.dart' show |
8 DiagnosticKind, | 8 DiagnosticKind, |
9 getMessage; | 9 getMessage; |
10 | 10 |
11 import 'hub/sentence_parser.dart' show | 11 import 'hub/sentence_parser.dart' show |
12 Preposition, | 12 Preposition, |
13 Target, | 13 Target, |
14 TargetKind, | 14 TargetKind, |
15 Verb; | 15 Verb; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 Diagnostic asDiagnostic() { | 181 Diagnostic asDiagnostic() { |
182 return new Diagnostic(kind, getMessage(kind), arguments); | 182 return new Diagnostic(kind, getMessage(kind), arguments); |
183 } | 183 } |
184 | 184 |
185 String toString() => 'InputError($kind, $arguments)'; | 185 String toString() => 'InputError($kind, $arguments)'; |
186 } | 186 } |
187 | 187 |
188 /// Throw an internal error that will be recorded as a compiler crash. | 188 /// Throw an internal error that will be recorded as a compiler crash. |
189 /// | 189 /// |
190 /// In general, assume, no matter how unlikely, that [message] may be read by a | 190 /// In general, assume, no matter how unlikely, that [message] may be read by a |
191 /// user (that is, a developer using Fletch). For this reason, try to: | 191 /// user (that is, a developer using Dartino). For this reason, try to: |
192 /// | 192 /// |
193 /// * Avoid phrases that can be interpreted as blaming the user (all error | 193 /// * Avoid phrases that can be interpreted as blaming the user (all error |
194 /// messages should state what is wrong, in a way that doesn't assign blame). | 194 /// messages should state what is wrong, in a way that doesn't assign blame). |
195 /// | 195 /// |
196 /// * Avoid being cute or funny (there's nothing more frustrating than being | 196 /// * Avoid being cute or funny (there's nothing more frustrating than being |
197 /// affected by a bug and see a cute or funny message, especially if it | 197 /// affected by a bug and see a cute or funny message, especially if it |
198 /// happens a lot). | 198 /// happens a lot). |
199 /// | 199 /// |
200 /// * Avoid phrases like "unreachable", "can't happen", "shouldn't happen", | 200 /// * Avoid phrases like "unreachable", "can't happen", "shouldn't happen", |
201 /// "shouldn't be called", simply because it is wrong: it did happen. In most | 201 /// "shouldn't be called", simply because it is wrong: it did happen. In most |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 arguments[DiagnosticParameter.uri] = uri; | 251 arguments[DiagnosticParameter.uri] = uri; |
252 } | 252 } |
253 if (requiredTarget != null) { | 253 if (requiredTarget != null) { |
254 arguments[DiagnosticParameter.requiredTarget] = requiredTarget; | 254 arguments[DiagnosticParameter.requiredTarget] = requiredTarget; |
255 } | 255 } |
256 if (fixit != null) { | 256 if (fixit != null) { |
257 arguments[DiagnosticParameter.fixit] = fixit; | 257 arguments[DiagnosticParameter.fixit] = fixit; |
258 } | 258 } |
259 throw new InputError(kind, arguments); | 259 throw new InputError(kind, arguments); |
260 } | 260 } |
OLD | NEW |