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 |
| 11 static final NOT_ASSIGNABLE = const MessageKind( | 11 static final NOT_ASSIGNABLE = const MessageKind( |
| 12 '#{2} is not assignable to #{1}'); | 12 '#{2} is not assignable to #{1}'); |
| 13 static final VOID_EXPRESSION = const MessageKind( | 13 static final VOID_EXPRESSION = const MessageKind( |
| 14 'expression does not yield a value'); | 14 'expression does not yield a value'); |
| 15 static final VOID_VARIABLE = const MessageKind( | 15 static final VOID_VARIABLE = const MessageKind( |
| 16 'variable cannot be of type void'); | 16 'variable cannot be of type void'); |
| 17 static final RETURN_VALUE_IN_VOID = const MessageKind( | 17 static final RETURN_VALUE_IN_VOID = const MessageKind( |
| 18 'cannot return value from void function'); | 18 'cannot return value from void function'); |
| 19 static final RETURN_NOTHING = const MessageKind( | 19 static final RETURN_NOTHING = const MessageKind( |
| 20 'value of type #{1} expected'); | 20 'value of type #{1} expected'); |
| 21 static final MISSING_ARGUMENT = const MessageKind( | 21 static final MISSING_ARGUMENT = const MessageKind( |
| 22 'missing argument of type #{1}'); | 22 'missing argument of type #{1}'); |
| 23 static final ADDITIONAL_ARGUMENT = const MessageKind( | 23 static final ADDITIONAL_ARGUMENT = const MessageKind( |
| 24 'additional argument'); | 24 'additional argument'); |
| 25 static final METHOD_NOT_FOUND = const MessageKind( | 25 static final METHOD_NOT_FOUND = const MessageKind( |
| 26 'no method named #{2} in class #{1}'); | 26 'no method named #{2} in class #{1}'); |
| 27 static final MEMBER_NOT_STATIC = const MessageKind( | 27 static final MEMBER_NOT_STATIC = const MessageKind( |
| 28 '#{1}.#{2} is not static'); | 28 '#{1}.#{2} is not static'); |
| 29 static final NOT_STATIC = const MessageKind( | |
| 30 '#{1} is not static'); | |
| 29 | 31 |
| 30 static final UNREACHABLE_CODE = const MessageKind( | 32 static final UNREACHABLE_CODE = const MessageKind( |
| 31 'unreachable code'); | 33 'unreachable code'); |
| 32 static final MISSING_RETURN = const MessageKind( | 34 static final MISSING_RETURN = const MessageKind( |
| 33 'missing return'); | 35 'missing return'); |
| 34 static final MAYBE_MISSING_RETURN = const MessageKind( | 36 static final MAYBE_MISSING_RETURN = const MessageKind( |
| 35 'not all paths lead to a return or throw statement'); | 37 'not all paths lead to a return or throw statement'); |
| 36 | 38 |
| 37 static final CANNOT_RESOLVE = const MessageKind( | 39 static final CANNOT_RESOLVE = const MessageKind( |
| 38 'cannot resolve #{1}'); | 40 'cannot resolve #{1}'); |
| 39 static final CANNOT_RESOLVE_TYPE = const MessageKind( | 41 static final CANNOT_RESOLVE_TYPE = const MessageKind( |
| 40 'cannot resolve type #{1}'); | 42 'cannot resolve type #{1}'); |
| 41 static final DUPLICATE_DEFINITION = const MessageKind( | 43 static final DUPLICATE_DEFINITION = const MessageKind( |
| 42 'duplicate definition of #{1}'); | 44 'duplicate definition of #{1}'); |
| 43 static final NOT_A_TYPE = const MessageKind( | 45 static final NOT_A_TYPE = const MessageKind( |
| 44 '#{1} is not a type'); | 46 '#{1} is not a type'); |
| 45 static final CANNOT_FIND_CONSTRUCTOR = const MessageKind( | 47 static final CANNOT_FIND_CONSTRUCTOR = const MessageKind( |
| 46 'cannot find constructor #{1}'); | 48 'cannot find constructor #{1}'); |
| 49 static final INVALID_RECEIVER_IN_INITIALIZER = const MessageKind( | |
| 50 'field initializer expected'); | |
| 51 static final DUPLICATE_INITIALIZER = const MessageKind( | |
| 52 'field #{1} is initialized more than once (before at #{2})'); | |
|
ngeoffray
2011/12/21 11:52:11
before at -> already initialized at ?
ahe
2011/12/21 12:01:58
I'm not sure I understand this. Won't it just say:
karlklose
2011/12/21 16:33:46
Removed 'before at' in favor of a second warning.
karlklose
2011/12/21 16:33:46
No, it would print the initializer node. I removed
| |
| 53 static final INIT_STATIC_FIELD = const MessageKind( | |
| 54 'cannot initialize static field #{1}'); | |
| 55 static final NOT_A_FIELD = const MessageKind( | |
| 56 '#{1} is not a field'); | |
| 47 | 57 |
| 48 toString() => template; | 58 toString() => template; |
| 49 } | 59 } |
| 50 | 60 |
| 51 class Message { | 61 class Message { |
| 52 final kind; | 62 final kind; |
| 53 final List arguments; | 63 final List arguments; |
| 54 String message; | 64 String message; |
| 55 | 65 |
| 56 Message(this.kind, this.arguments); | 66 Message(this.kind, this.arguments); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 String toString() => message.toString(); | 99 String toString() => message.toString(); |
| 90 } | 100 } |
| 91 | 101 |
| 92 class ResolutionWarning { | 102 class ResolutionWarning { |
| 93 final Message message; | 103 final Message message; |
| 94 ResolutionWarning.message(this.message); | 104 ResolutionWarning.message(this.message); |
| 95 ResolutionWarning(MessageKind kind, List<Type> arguments) | 105 ResolutionWarning(MessageKind kind, List<Type> arguments) |
| 96 : message = new Message(kind, arguments); | 106 : message = new Message(kind, arguments); |
| 97 String toString() => message.toString(); | 107 String toString() => message.toString(); |
| 98 } | 108 } |
| OLD | NEW |