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( | 29 static final NO_INSTANCE_AVAILABLE = const MessageKind( |
| 30 '#{1} is not static'); | 30 '#{1} is only available in instance methods'); |
| 31 | 31 |
| 32 static final UNREACHABLE_CODE = const MessageKind( | 32 static final UNREACHABLE_CODE = const MessageKind( |
| 33 'unreachable code'); | 33 'unreachable code'); |
| 34 static final MISSING_RETURN = const MessageKind( | 34 static final MISSING_RETURN = const MessageKind( |
| 35 'missing return'); | 35 'missing return'); |
| 36 static final MAYBE_MISSING_RETURN = const MessageKind( | 36 static final MAYBE_MISSING_RETURN = const MessageKind( |
| 37 'not all paths lead to a return or throw statement'); | 37 'not all paths lead to a return or throw statement'); |
| 38 | 38 |
| 39 static final CANNOT_RESOLVE = const MessageKind( | 39 static final CANNOT_RESOLVE = const MessageKind( |
| 40 'cannot resolve #{1}'); | 40 'cannot resolve #{1}'); |
| 41 static final CANNOT_RESOLVE_TYPE = const MessageKind( | 41 static final CANNOT_RESOLVE_TYPE = const MessageKind( |
| 42 'cannot resolve type #{1}'); | 42 'cannot resolve type #{1}'); |
| 43 static final DUPLICATE_DEFINITION = const MessageKind( | 43 static final DUPLICATE_DEFINITION = const MessageKind( |
| 44 'duplicate definition of #{1}'); | 44 'duplicate definition of #{1}'); |
| 45 static final NOT_A_TYPE = const MessageKind( | 45 static final NOT_A_TYPE = const MessageKind( |
| 46 '#{1} is not a type'); | 46 '#{1} is not a type'); |
| 47 static final NO_SUPER_IN_OBJECT = const MessageKind( | 47 static final NO_SUPER_IN_OBJECT = const MessageKind( |
| 48 '\'Object\' does not have a superclass'); | 48 '\'Object\' does not have a superclass'); |
| 49 static final CANNOT_FIND_CONSTRUCTOR = const MessageKind( | 49 static final CANNOT_FIND_CONSTRUCTOR = const MessageKind( |
| 50 'cannot find constructor #{1}'); | 50 'cannot find constructor #{1}'); |
| 51 static final INVALID_RECEIVER_IN_INITIALIZER = const MessageKind( | 51 static final INVALID_RECEIVER_IN_INITIALIZER = const MessageKind( |
| 52 'field initializer expected'); | 52 'field initializer expected'); |
| 53 static final NO_THIS_IN_STATIC = const MessageKind( | |
| 54 '\'this\' is only available in instance methods'); | |
| 55 static final NO_SUPER_IN_STATIC = const MessageKind( | 53 static final NO_SUPER_IN_STATIC = const MessageKind( |
| 56 '\'super\' is only available in instance methods'); | 54 '\'super\' is only available in instance methods'); |
| 57 static final DUPLICATE_INITIALIZER = const MessageKind( | 55 static final DUPLICATE_INITIALIZER = const MessageKind( |
| 58 'field #{1} is initialized more than once'); | 56 'field #{1} is initialized more than once'); |
| 59 static final ALREADY_INITIALIZED = const MessageKind( | 57 static final ALREADY_INITIALIZED = const MessageKind( |
| 60 '#{1} was already initialized here'); | 58 '#{1} was already initialized here'); |
| 61 static final INIT_STATIC_FIELD = const MessageKind( | 59 static final INIT_STATIC_FIELD = const MessageKind( |
| 62 'cannot initialize static field #{1}'); | 60 'cannot initialize static field #{1}'); |
| 63 static final NOT_A_FIELD = const MessageKind( | 61 static final NOT_A_FIELD = const MessageKind( |
| 64 '#{1} is not a field'); | 62 '#{1} is not a field'); |
| 63 static final CONSTRUCTOR_CALL_EXPECTED = const MessageKind( | |
| 64 'only call to \'this\' or \'super\' constructor allowed'); | |
|
floitsch
2012/01/18 15:22:14
you could avoid the escapes by using " to delimit
karlklose
2012/01/18 16:36:09
Done.
| |
| 65 static final INVALID_FOR_IN = const MessageKind( | 65 static final INVALID_FOR_IN = const MessageKind( |
| 66 'Invalid for-in variable declaration.'); | 66 'Invalid for-in variable declaration.'); |
| 67 static final REDIRECTING_CTOR_HAS_INITIALIZER = const MessageKind( | |
| 68 'redirecting constructor cannot have other initializers'); | |
| 69 static final SUPER_INITIALIZER_IN_OBJECT = const MessageKind( | |
| 70 "'Object' cannot have a superinitializer"); | |
|
floitsch
2012/01/18 15:22:14
super initializer
karlklose
2012/01/18 16:36:09
Done.
| |
| 71 static final DUPLICATE_SUPER_INITIALIZER = const MessageKind( | |
| 72 'cannot have more than one super initializer'); | |
| 73 static final NO_MATCHING_CONSTRUCTOR = const MessageKind( | |
| 74 'no matching constructor found'); | |
| 75 static final NO_CONSTRUCTOR = const MessageKind( | |
| 76 '#{1} is a #{2}, not a constructor'); | |
| 67 | 77 |
| 68 toString() => template; | 78 toString() => template; |
| 69 } | 79 } |
| 70 | 80 |
| 71 class Message { | 81 class Message { |
| 72 final kind; | 82 final kind; |
| 73 final List arguments; | 83 final List arguments; |
| 74 String message; | 84 String message; |
| 75 | 85 |
| 76 Message(this.kind, this.arguments); | 86 Message(this.kind, this.arguments); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 String toString() => message.toString(); | 118 String toString() => message.toString(); |
| 109 } | 119 } |
| 110 | 120 |
| 111 class ResolutionWarning { | 121 class ResolutionWarning { |
| 112 final Message message; | 122 final Message message; |
| 113 ResolutionWarning.message(this.message); | 123 ResolutionWarning.message(this.message); |
| 114 ResolutionWarning(MessageKind kind, List<Type> arguments) | 124 ResolutionWarning(MessageKind kind, List<Type> arguments) |
| 115 : message = new Message(kind, arguments); | 125 : message = new Message(kind, arguments); |
| 116 String toString() => message.toString(); | 126 String toString() => message.toString(); |
| 117 } | 127 } |
| OLD | NEW |