| 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 class MessageKind { | 5 class MessageKind { |
| 6 final String template; | 6 final String template; |
| 7 const MessageKind(this.template); | 7 const MessageKind(this.template); |
| 8 | 8 |
| 9 static final GENERIC = const MessageKind('#{1}'); | 9 static final GENERIC = const MessageKind('#{1}'); |
| 10 | 10 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 static final NO_CONTINUE_TARGET = const MessageKind( | 109 static final NO_CONTINUE_TARGET = const MessageKind( |
| 110 'continue statement not inside loop'); | 110 'continue statement not inside loop'); |
| 111 static final EXISTING_LABEL = const MessageKind( | 111 static final EXISTING_LABEL = const MessageKind( |
| 112 'original declaration of duplicate label #{1}'); | 112 'original declaration of duplicate label #{1}'); |
| 113 static final DUPLICATE_LABEL = const MessageKind( | 113 static final DUPLICATE_LABEL = const MessageKind( |
| 114 'duplicate declaration of label #{1}'); | 114 'duplicate declaration of label #{1}'); |
| 115 static final UNUSED_LABEL = const MessageKind( | 115 static final UNUSED_LABEL = const MessageKind( |
| 116 'unused label #{1}'); | 116 'unused label #{1}'); |
| 117 static final INVALID_CONTINUE = const MessageKind( | 117 static final INVALID_CONTINUE = const MessageKind( |
| 118 'target of continue is not a loop or switch case'); | 118 'target of continue is not a loop or switch case'); |
| 119 static final TYPE_VARIABLE_AS_CONSTRUCTOR = const MessageKind( |
| 120 'cannot use type variable as constructor'); |
| 119 static final INVALID_BREAK = const MessageKind( | 121 static final INVALID_BREAK = const MessageKind( |
| 120 'target of break is not a statement'); | 122 'target of break is not a statement'); |
| 121 static final INVALID_USE_OF_SUPER = const MessageKind( | 123 static final INVALID_USE_OF_SUPER = const MessageKind( |
| 122 'super not allowed here'); | 124 'super not allowed here'); |
| 123 static final INVALID_CASE_DEFAULT = const MessageKind( | 125 static final INVALID_CASE_DEFAULT = const MessageKind( |
| 124 'default only allowed on last case of a switch'); | 126 'default only allowed on last case of a switch'); |
| 125 | 127 |
| 126 static final NOT_A_COMPILE_TIME_CONSTANT = const MessageKind( | 128 static final NOT_A_COMPILE_TIME_CONSTANT = const MessageKind( |
| 127 'not a compile-time constant'); | 129 'not a compile-time constant'); |
| 128 static final CYCLIC_COMPILE_TIME_CONSTANTS = const MessageKind( | 130 static final CYCLIC_COMPILE_TIME_CONSTANTS = const MessageKind( |
| 129 'cycle in the compile-time constant computation'); | 131 'cycle in the compile-time constant computation'); |
| 130 | 132 |
| 131 static final KEY_NOT_A_STRING_LITERAL = const MessageKind( | 133 static final KEY_NOT_A_STRING_LITERAL = const MessageKind( |
| 132 'map-literal key not a string literal'); | 134 'map-literal key not a string literal'); |
| 133 | 135 |
| 134 static final NO_SUCH_LIBRARY_MEMBER = const MessageKind( | 136 static final NO_SUCH_LIBRARY_MEMBER = const MessageKind( |
| 135 '#{1} has no member named #{2}'); | 137 '#{1} has no member named #{2}'); |
| 136 | 138 |
| 137 static final CANNOT_INSTANTIATE_INTERFACE = const MessageKind( | 139 static final CANNOT_INSTANTIATE_INTERFACE = const MessageKind( |
| 138 "cannot instantiate interface '#{1}'"); | 140 "cannot instantiate interface '#{1}'"); |
| 139 | 141 |
| 140 static final CANNOT_INSTANTIATE_TYPEDEF = const MessageKind( | 142 static final CANNOT_INSTANTIATE_TYPEDEF = const MessageKind( |
| 141 "cannot instantiate typedef '#{1}'"); | 143 "cannot instantiate typedef '#{1}'"); |
| 142 | 144 |
| 143 static final NO_DEFAULT_CLASS = const MessageKind( | 145 static final NO_DEFAULT_CLASS = const MessageKind( |
| 144 "no default class on enclosing interface '#{1}'"); | 146 "no default class on enclosing interface '#{1}'"); |
| 145 | 147 |
| 148 static final CYCLIC_TYPE_VARIABLE = const MessageKind( |
| 149 "cyclic reference to type variable #{1}"); |
| 150 static final TYPE_NAME_EXPECTED = const MessageKind( |
| 151 "class or interface name exptected"); |
| 146 toString() => template; | 152 toString() => template; |
| 147 } | 153 } |
| 148 | 154 |
| 149 class Message { | 155 class Message { |
| 150 final kind; | 156 final kind; |
| 151 final List arguments; | 157 final List arguments; |
| 152 String message; | 158 String message; |
| 153 | 159 |
| 154 Message(this.kind, this.arguments); | 160 Message(this.kind, this.arguments); |
| 155 | 161 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 String toString() => message.toString(); | 209 String toString() => message.toString(); |
| 204 } | 210 } |
| 205 | 211 |
| 206 class CompileTimeConstantError { | 212 class CompileTimeConstantError { |
| 207 final Message message; | 213 final Message message; |
| 208 CompileTimeConstantError.message(this.message); | 214 CompileTimeConstantError.message(this.message); |
| 209 CompileTimeConstantError(MessageKind kind, List<Type> arguments) | 215 CompileTimeConstantError(MessageKind kind, List<Type> arguments) |
| 210 : message = new Message(kind, arguments); | 216 : message = new Message(kind, arguments); |
| 211 String toString() => message.toString(); | 217 String toString() => message.toString(); |
| 212 } | 218 } |
| OLD | NEW |