Chromium Code Reviews| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 static final FIELD_PARAMETER_NOT_ALLOWED = const MessageKind( | 79 static final FIELD_PARAMETER_NOT_ALLOWED = const MessageKind( |
| 80 'A field parameter is only allowed in generative constructors'); | 80 'A field parameter is only allowed in generative constructors'); |
| 81 static final INVALID_PARAMETER = const MessageKind( | 81 static final INVALID_PARAMETER = const MessageKind( |
| 82 "Cannot resolve parameter"); | 82 "Cannot resolve parameter"); |
| 83 static final NOT_INSTANCE_FIELD = const MessageKind( | 83 static final NOT_INSTANCE_FIELD = const MessageKind( |
| 84 '#{1} is not an instance field'); | 84 '#{1} is not an instance field'); |
| 85 | 85 |
| 86 static final NOT_A_COMPILE_TIME_CONSTANT = const MessageKind( | 86 static final NOT_A_COMPILE_TIME_CONSTANT = const MessageKind( |
| 87 '#{1} cannot be used as compile-time constant'); | 87 '#{1} cannot be used as compile-time constant'); |
| 88 | 88 |
| 89 static final INVALID_STRING_ESCAPE = const MessageKind( | |
| 90 'Unexpected character or end-of-string in string escape at index #{1}'); | |
|
ahe
2012/01/25 08:39:44
I'm not a big fan of telling the user: I'm not sur
ahe
2012/01/25 08:39:44
"Unexpected" should be lowercase to be consistent
ahe
2012/01/25 08:39:44
" at index #{1}" should be removed. Instead this p
Lasse Reichstein Nielsen
2012/01/26 10:14:20
I'm removing all of these, since I'm not using the
| |
| 91 static final INVALID_SINGLE_LINE_STRING = const MessageKind( | |
| 92 'Line terminator in single-line string at index #{1}'); | |
|
ahe
2012/01/25 08:39:44
Lowercase and remove "at index #{1}".
| |
| 93 static final INVALID_UNICODE_SCALAR = const MessageKind( | |
| 94 'Invalid character U+#{2} in string escape at index #{1}'); | |
|
ahe
2012/01/25 08:39:44
Lowercase and remove "at index #{1}".
| |
| 95 | |
| 96 | |
| 89 toString() => template; | 97 toString() => template; |
| 90 } | 98 } |
| 91 | 99 |
| 92 class Message { | 100 class Message { |
| 93 final kind; | 101 final kind; |
| 94 final List arguments; | 102 final List arguments; |
| 95 String message; | 103 String message; |
| 96 | 104 |
| 97 Message(this.kind, this.arguments); | 105 Message(this.kind, this.arguments); |
| 98 | 106 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 String toString() => message.toString(); | 145 String toString() => message.toString(); |
| 138 } | 146 } |
| 139 | 147 |
| 140 class CompileTimeConstantError { | 148 class CompileTimeConstantError { |
| 141 final Message message; | 149 final Message message; |
| 142 CompileTimeConstantError.message(this.message); | 150 CompileTimeConstantError.message(this.message); |
| 143 CompileTimeConstantError(MessageKind kind, List<Type> arguments) | 151 CompileTimeConstantError(MessageKind kind, List<Type> arguments) |
| 144 : message = new Message(kind, arguments); | 152 : message = new Message(kind, arguments); |
| 145 String toString() => message.toString(); | 153 String toString() => message.toString(); |
| 146 } | 154 } |
| OLD | NEW |