| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 ErrorToken, | 67 ErrorToken, |
| 68 Token; | 68 Token; |
| 69 | 69 |
| 70 import 'invariant.dart' show | 70 import 'invariant.dart' show |
| 71 invariant; | 71 invariant; |
| 72 import 'spannable.dart' show | 72 import 'spannable.dart' show |
| 73 CURRENT_ELEMENT_SPANNABLE; | 73 CURRENT_ELEMENT_SPANNABLE; |
| 74 | 74 |
| 75 import 'generated/shared_messages.dart' as shared_messages; | 75 import 'generated/shared_messages.dart' as shared_messages; |
| 76 | 76 |
| 77 export 'generated/shared_messages.dart' show SharedMessageKind; | |
| 78 | |
| 79 const DONT_KNOW_HOW_TO_FIX = "Computer says no!"; | 77 const DONT_KNOW_HOW_TO_FIX = "Computer says no!"; |
| 80 | 78 |
| 81 /// Keys for the [MessageTemplate]s. | 79 /// Keys for the [MessageTemplate]s. |
| 82 enum MessageKind { | 80 enum MessageKind { |
| 83 ABSTRACT_CLASS_INSTANTIATION, | 81 ABSTRACT_CLASS_INSTANTIATION, |
| 84 ABSTRACT_GETTER, | 82 ABSTRACT_GETTER, |
| 85 ABSTRACT_METHOD, | 83 ABSTRACT_METHOD, |
| 86 ABSTRACT_SETTER, | 84 ABSTRACT_SETTER, |
| 87 ACCESSED_IN_CLOSURE, | 85 ACCESSED_IN_CLOSURE, |
| 88 ACCESSED_IN_CLOSURE_HERE, | 86 ACCESSED_IN_CLOSURE_HERE, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 CANNOT_RESOLVE_SETTER, | 137 CANNOT_RESOLVE_SETTER, |
| 140 CANNOT_RESOLVE_TYPE, | 138 CANNOT_RESOLVE_TYPE, |
| 141 CANNOT_RETURN_FROM_CONSTRUCTOR, | 139 CANNOT_RETURN_FROM_CONSTRUCTOR, |
| 142 CLASS_NAME_EXPECTED, | 140 CLASS_NAME_EXPECTED, |
| 143 COMPILER_CRASHED, | 141 COMPILER_CRASHED, |
| 144 COMPLEX_RETURNING_NSM, | 142 COMPLEX_RETURNING_NSM, |
| 145 COMPLEX_THROWING_NSM, | 143 COMPLEX_THROWING_NSM, |
| 146 CONSIDER_ANALYZE_ALL, | 144 CONSIDER_ANALYZE_ALL, |
| 147 CONST_CALLS_NON_CONST, | 145 CONST_CALLS_NON_CONST, |
| 148 CONST_CALLS_NON_CONST_FOR_IMPLICIT, | 146 CONST_CALLS_NON_CONST_FOR_IMPLICIT, |
| 149 CONST_CONSTRUCTOR_HAS_BODY, | 147 CONST_CONSTRUCTOR_OR_FACTORY_WITH_BODY, |
| 150 CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS, | 148 CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS, |
| 151 CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR, | 149 CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR, |
| 152 CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD, | 150 CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD, |
| 153 CONST_LOOP_VARIABLE, | 151 CONST_LOOP_VARIABLE, |
| 154 CONST_MAP_KEY_OVERRIDES_EQUALS, | 152 CONST_MAP_KEY_OVERRIDES_EQUALS, |
| 155 CONST_WITHOUT_INITIALIZER, | 153 CONST_WITHOUT_INITIALIZER, |
| 156 CONSTRUCTOR_CALL_EXPECTED, | 154 CONSTRUCTOR_CALL_EXPECTED, |
| 157 CONSTRUCTOR_IS_NOT_CONST, | 155 CONSTRUCTOR_IS_NOT_CONST, |
| 158 CONSTRUCTOR_WITH_RETURN_TYPE, | 156 CONSTRUCTOR_WITH_RETURN_TYPE, |
| 159 CYCLIC_CLASS_HIERARCHY, | 157 CYCLIC_CLASS_HIERARCHY, |
| (...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 "Only constructors can have initializers."), | 970 "Only constructors can have initializers."), |
| 973 | 971 |
| 974 MessageKind.REDIRECTING_CONSTRUCTOR_CYCLE: | 972 MessageKind.REDIRECTING_CONSTRUCTOR_CYCLE: |
| 975 const MessageTemplate(MessageKind.REDIRECTING_CONSTRUCTOR_CYCLE, | 973 const MessageTemplate(MessageKind.REDIRECTING_CONSTRUCTOR_CYCLE, |
| 976 "Cyclic constructor redirection."), | 974 "Cyclic constructor redirection."), |
| 977 | 975 |
| 978 MessageKind.REDIRECTING_CONSTRUCTOR_HAS_BODY: | 976 MessageKind.REDIRECTING_CONSTRUCTOR_HAS_BODY: |
| 979 const MessageTemplate(MessageKind.REDIRECTING_CONSTRUCTOR_HAS_BODY, | 977 const MessageTemplate(MessageKind.REDIRECTING_CONSTRUCTOR_HAS_BODY, |
| 980 "Redirecting constructor can't have a body."), | 978 "Redirecting constructor can't have a body."), |
| 981 | 979 |
| 982 MessageKind.CONST_CONSTRUCTOR_HAS_BODY: | |
| 983 const MessageTemplate(MessageKind.CONST_CONSTRUCTOR_HAS_BODY, | |
| 984 "Const constructor or factory can't have a body.", | |
| 985 howToFix: "Remove the 'const' keyword or the body", | |
| 986 examples: const [""" | |
| 987 class C { | |
| 988 const C() {} | |
| 989 } | |
| 990 | |
| 991 main() => new C();"""]), | |
| 992 | |
| 993 MessageKind.REDIRECTING_CONSTRUCTOR_HAS_INITIALIZER: | 980 MessageKind.REDIRECTING_CONSTRUCTOR_HAS_INITIALIZER: |
| 994 const MessageTemplate( | 981 const MessageTemplate( |
| 995 MessageKind.REDIRECTING_CONSTRUCTOR_HAS_INITIALIZER, | 982 MessageKind.REDIRECTING_CONSTRUCTOR_HAS_INITIALIZER, |
| 996 "Redirecting constructor cannot have other initializers."), | 983 "Redirecting constructor cannot have other initializers."), |
| 997 | 984 |
| 998 MessageKind.SUPER_INITIALIZER_IN_OBJECT: | 985 MessageKind.SUPER_INITIALIZER_IN_OBJECT: |
| 999 const MessageTemplate(MessageKind.SUPER_INITIALIZER_IN_OBJECT, | 986 const MessageTemplate(MessageKind.SUPER_INITIALIZER_IN_OBJECT, |
| 1000 "'Object' cannot have a super initializer."), | 987 "'Object' cannot have a super initializer."), |
| 1001 | 988 |
| 1002 MessageKind.DUPLICATE_SUPER_INITIALIZER: | 989 MessageKind.DUPLICATE_SUPER_INITIALIZER: |
| (...skipping 2723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3726 static String convertToString(value) { | 3713 static String convertToString(value) { |
| 3727 if (value is ErrorToken) { | 3714 if (value is ErrorToken) { |
| 3728 // Shouldn't happen. | 3715 // Shouldn't happen. |
| 3729 return value.assertionMessage; | 3716 return value.assertionMessage; |
| 3730 } else if (value is Token) { | 3717 } else if (value is Token) { |
| 3731 value = value.value; | 3718 value = value.value; |
| 3732 } | 3719 } |
| 3733 return '$value'; | 3720 return '$value'; |
| 3734 } | 3721 } |
| 3735 } | 3722 } |
| OLD | NEW |