| 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 | 5 |
| 6 /** | 6 /** |
| 7 * The messages in this file should meet the following guide lines: | 7 * The messages in this file should meet the following guide lines: |
| 8 * | 8 * |
| 9 * 1. The message should be a complete sentence starting with an uppercase | 9 * 1. The message should be a complete sentence starting with an uppercase |
| 10 * letter, and ending with a period. | 10 * letter, and ending with a period. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 * or ERROR about the duplicated element, and then report an INFO about the | 56 * or ERROR about the duplicated element, and then report an INFO about the |
| 57 * location of the existing element. | 57 * location of the existing element. |
| 58 * | 58 * |
| 59 * Generally, we want to provide messages that consists of three sentences: | 59 * Generally, we want to provide messages that consists of three sentences: |
| 60 * 1. what is wrong, 2. why is it wrong, 3. how do I fix it. However, we | 60 * 1. what is wrong, 2. why is it wrong, 3. how do I fix it. However, we |
| 61 * combine the first two in [template] and the last in [howToFix]. | 61 * combine the first two in [template] and the last in [howToFix]. |
| 62 */ | 62 */ |
| 63 | 63 |
| 64 library dart2js.messages; | 64 library dart2js.messages; |
| 65 | 65 |
| 66 import '../tokens/token.dart' show |
| 67 ErrorToken, |
| 68 Token; |
| 69 |
| 66 import 'invariant.dart' show | 70 import 'invariant.dart' show |
| 67 invariant; | 71 invariant; |
| 68 import 'spannable.dart' show | 72 import 'spannable.dart' show |
| 69 CURRENT_ELEMENT_SPANNABLE; | 73 CURRENT_ELEMENT_SPANNABLE; |
| 70 import '../scanner/token.dart' show | |
| 71 ErrorToken, | |
| 72 Token; | |
| 73 | 74 |
| 74 const DONT_KNOW_HOW_TO_FIX = "Computer says no!"; | 75 const DONT_KNOW_HOW_TO_FIX = "Computer says no!"; |
| 75 | 76 |
| 76 /// Keys for the [MessageTemplate]s. | 77 /// Keys for the [MessageTemplate]s. |
| 77 enum MessageKind { | 78 enum MessageKind { |
| 78 ABSTRACT_CLASS_INSTANTIATION, | 79 ABSTRACT_CLASS_INSTANTIATION, |
| 79 ABSTRACT_GETTER, | 80 ABSTRACT_GETTER, |
| 80 ABSTRACT_METHOD, | 81 ABSTRACT_METHOD, |
| 81 ABSTRACT_SETTER, | 82 ABSTRACT_SETTER, |
| 82 ACCESSED_IN_CLOSURE, | 83 ACCESSED_IN_CLOSURE, |
| (...skipping 3273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3356 static String convertToString(value) { | 3357 static String convertToString(value) { |
| 3357 if (value is ErrorToken) { | 3358 if (value is ErrorToken) { |
| 3358 // Shouldn't happen. | 3359 // Shouldn't happen. |
| 3359 return value.assertionMessage; | 3360 return value.assertionMessage; |
| 3360 } else if (value is Token) { | 3361 } else if (value is Token) { |
| 3361 value = value.value; | 3362 value = value.value; |
| 3362 } | 3363 } |
| 3363 return '$value'; | 3364 return '$value'; |
| 3364 } | 3365 } |
| 3365 } | 3366 } |
| OLD | NEW |