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 NO_CONSTRUCTOR = const MessageKind( | 79 static final NO_CONSTRUCTOR = const MessageKind( |
80 '#{1} is a #{2}, not a constructor'); | 80 '#{1} is a #{2}, not a constructor'); |
81 static final FIELD_PARAMETER_NOT_ALLOWED = const MessageKind( | 81 static final FIELD_PARAMETER_NOT_ALLOWED = const MessageKind( |
82 'a field parameter is only allowed in generative constructors'); | 82 'a field parameter is only allowed in generative constructors'); |
83 static final INVALID_PARAMETER = const MessageKind( | 83 static final INVALID_PARAMETER = const MessageKind( |
84 "cannot resolve parameter"); | 84 "cannot resolve parameter"); |
85 static final NOT_INSTANCE_FIELD = const MessageKind( | 85 static final NOT_INSTANCE_FIELD = const MessageKind( |
86 '#{1} is not an instance field'); | 86 '#{1} is not an instance field'); |
87 static final EXPECTED_LITERAL_NUMBER = const MessageKind( | 87 static final EXPECTED_LITERAL_NUMBER = const MessageKind( |
88 'expected a literal number after +'); | 88 'expected a literal number after +'); |
89 static final NO_CATCH_NOR_FINALLY = const MessageKind( | |
90 'expected a catch block or finally block after a try block'); | |
ahe
2012/02/07 19:10:35
I suggest shortening this error to:
expected 'cat
ngeoffray
2012/02/08 09:52:23
Done.
| |
91 static final EMPTY_CATCH_DECLARATION = const MessageKind( | |
92 'expected a variable in a catch declaration'); | |
93 static final TOO_MANY_CATCH_DECLARATIONS = const MessageKind( | |
94 'too many variables in a catch declaration'); | |
ahe
2012/02/07 19:10:35
I'd stick to the singular case and report one erro
ngeoffray
2012/02/08 09:52:23
Done.
| |
89 | 95 |
90 static final NOT_A_COMPILE_TIME_CONSTANT = const MessageKind( | 96 static final NOT_A_COMPILE_TIME_CONSTANT = const MessageKind( |
91 '#{1} cannot be used as compile-time constant'); | 97 '#{1} cannot be used as compile-time constant'); |
92 | 98 |
93 static final NO_SUCH_LIBRARY_MEMBER = const MessageKind( | 99 static final NO_SUCH_LIBRARY_MEMBER = const MessageKind( |
94 '#{1} has no member named #{2}'); | 100 '#{1} has no member named #{2}'); |
95 | 101 |
96 toString() => template; | 102 toString() => template; |
97 } | 103 } |
98 | 104 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 String toString() => message.toString(); | 150 String toString() => message.toString(); |
145 } | 151 } |
146 | 152 |
147 class CompileTimeConstantError { | 153 class CompileTimeConstantError { |
148 final Message message; | 154 final Message message; |
149 CompileTimeConstantError.message(this.message); | 155 CompileTimeConstantError.message(this.message); |
150 CompileTimeConstantError(MessageKind kind, List<Type> arguments) | 156 CompileTimeConstantError(MessageKind kind, List<Type> arguments) |
151 : message = new Message(kind, arguments); | 157 : message = new Message(kind, arguments); |
152 String toString() => message.toString(); | 158 String toString() => message.toString(); |
153 } | 159 } |
OLD | NEW |