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 part of dart2js; | 5 part of dart2js; |
| 6 | 6 |
| 7 class MessageKind { | 7 class MessageKind { |
| 8 final String template; | 8 final String template; |
| 9 const MessageKind(this.template); | 9 const MessageKind(this.template); |
| 10 | 10 |
| 11 static const GENERIC = const MessageKind('#{text}'); | 11 static const MessageKind GENERIC = const MessageKind('#{text}'); |
| 12 | 12 |
| 13 static const NOT_ASSIGNABLE = const MessageKind( | 13 static const DualKind NOT_ASSIGNABLE = const DualKind( |
| 14 '#{fromType} is not assignable to #{toType}'); | 14 error: const MessageKind( |
| 15 static const VOID_EXPRESSION = const MessageKind( | 15 'Error: "#{fromType}" is not assignable to "#{toType}".'), |
| 16 'expression does not yield a value'); | 16 warning: const MessageKind( |
| 17 static const VOID_VARIABLE = const MessageKind( | 17 'Warning: "#{fromType}" is not assignable to "#{toType}".')); |
| 18 'variable cannot be of type void'); | 18 |
| 19 static const RETURN_VALUE_IN_VOID = const MessageKind( | 19 static const MessageKind VOID_EXPRESSION = const MessageKind( |
| 20 'cannot return value from void function'); | 20 'Warning: Expression does not yield a value.'); |
| 21 static const RETURN_NOTHING = const MessageKind( | 21 |
| 22 'value of type #{returnType} expected'); | 22 static const MessageKind VOID_VARIABLE = const MessageKind( |
| 23 static const MISSING_ARGUMENT = const MessageKind( | 23 'Warning: Variable cannot be of type void.'); |
| 24 'missing argument of type #{argumentType}'); | 24 |
| 25 static const ADDITIONAL_ARGUMENT = const MessageKind( | 25 static const MessageKind RETURN_VALUE_IN_VOID = const MessageKind( |
| 26 'additional argument'); | 26 'Warning: Cannot return value from void function.'); |
| 27 static const NAMED_ARGUMENT_NOT_FOUND = const MessageKind( | 27 |
| 28 "no named argument '#{argumentName}' found on method"); | 28 static const MessageKind RETURN_NOTHING = const MessageKind( |
| 29 static const MEMBER_NOT_FOUND = const MessageKind( | 29 'Warning: Value of type "#{returnType}" expected.'); |
| 30 'no member named #{memberName} in class #{className}'); | 30 |
| 31 static const METHOD_NOT_FOUND = const MessageKind( | 31 static const MessageKind MISSING_ARGUMENT = const MessageKind( |
| 32 'no method named #{memberName} in class #{className}'); | 32 'Warning: Missing argument of type "#{argumentType}".'); |
| 33 static const OPERATOR_NOT_FOUND = const MessageKind( | 33 |
| 34 'no operator #{memberName} in class #{className}'); | 34 static const MessageKind ADDITIONAL_ARGUMENT = const MessageKind( |
| 35 static const PROPERTY_NOT_FOUND = const MessageKind( | 35 'Warning: Additional argument.'); |
| 36 'no property named #{memberName} in class #{className}'); | 36 |
| 37 static const NOT_CALLABLE = const MessageKind( | 37 static const MessageKind NAMED_ARGUMENT_NOT_FOUND = const MessageKind( |
| 38 "'#{elementName}' is not callable"); | 38 'Warning: No named argument "#{argumentName}" found on method.'); |
| 39 static const MEMBER_NOT_STATIC = const MessageKind( | 39 |
| 40 '#{className}.#{memberName} is not static'); | 40 static const DualKind MEMBER_NOT_FOUND = const DualKind( |
| 41 static const NO_INSTANCE_AVAILABLE = const MessageKind( | 41 error: const MessageKind( |
| 42 '#{name} is only available in instance methods'); | 42 'Error: No member named "#{memberName}" in class "#{className}".'), |
| 43 static const PRIVATE_ACCESS = const MessageKind( | 43 warning: const MessageKind( |
| 44 "'#{name}' is declared private within library #{libraryName} and " | 44 'Warning: No member named "#{memberName}" in class "#{className}".')); |
| 45 "is therefore not accessible."); | 45 |
| 46 | 46 static const MessageKind METHOD_NOT_FOUND = const MessageKind( |
| 47 static const THIS_IS_THE_METHOD = const MessageKind( | 47 'Warning: No method named "#{memberName}" in class "#{className}".'); |
| 48 "This is the method declaration."); | 48 |
| 49 | 49 static const MessageKind OPERATOR_NOT_FOUND = const MessageKind( |
| 50 static const UNREACHABLE_CODE = const MessageKind( | 50 'Warning: No operator "#{memberName}" in class "#{className}".'); |
| 51 'unreachable code'); | 51 |
| 52 static const MISSING_RETURN = const MessageKind( | 52 static const MessageKind PROPERTY_NOT_FOUND = const MessageKind( |
| 53 'missing return'); | 53 'Warning: No property named "#{memberName}" in class "#{className}".'); |
| 54 static const MAYBE_MISSING_RETURN = const MessageKind( | 54 |
| 55 'not all paths lead to a return or throw statement'); | 55 static const MessageKind NOT_CALLABLE = const MessageKind( |
| 56 | 56 'Warning: "#{elementName}" is not callable.'); |
| 57 static const CANNOT_RESOLVE = const MessageKind( | 57 |
| 58 'cannot resolve #{name}'); | 58 static const DualKind MEMBER_NOT_STATIC = const DualKind( |
| 59 static const CANNOT_RESOLVE_CONSTRUCTOR = const MessageKind( | 59 error: const MessageKind( |
| 60 'cannot resolve constructor #{constructorName}'); | 60 'Error: "#{className}.#{memberName}" is not static.'), |
| 61 static const CANNOT_RESOLVE_CONSTRUCTOR_FOR_IMPLICIT = const MessageKind( | 61 warning: const MessageKind( |
| 62 'cannot resolve constructor #{constructorName} for implicit super call'); | 62 'Warning: "#{className}.#{memberName}" is not static.')); |
| 63 static const INVALID_UNNAMED_CONSTRUCTOR_NAME = const MessageKind( | 63 |
| 64 'Error: Unnamed constructor name must be #{name}.'); | 64 static const MessageKind NO_INSTANCE_AVAILABLE = const MessageKind( |
| 65 static const INVALID_CONSTRUCTOR_NAME = const MessageKind( | 65 'Error: "#{name}" is only available in instance methods.'); |
| 66 'Error: Constructor name must start with #{name}.'); | 66 |
| 67 static const CANNOT_RESOLVE_TYPE = const MessageKind( | 67 static const MessageKind PRIVATE_ACCESS = const MessageKind( |
| 68 'cannot resolve type #{typeName}'); | 68 'Warning: "#{name}" is declared private within library ' |
| 69 static const DUPLICATE_DEFINITION = const MessageKind( | 69 '"#{libraryName}".'); |
| 70 "Error: Duplicate definition of '#{name}'."); | 70 |
| 71 static const EXISTING_DEFINITION = const MessageKind( | 71 static const MessageKind THIS_IS_THE_METHOD = const MessageKind( |
| 72 "Info: Existing definition of '#{name}'."); | 72 'Info: This is the method declaration.'); |
| 73 static const DUPLICATE_IMPORT = const MessageKind( | 73 |
| 74 'duplicate import of #{name}'); | 74 static const MessageKind UNREACHABLE_CODE = const MessageKind( |
| 75 static const DUPLICATE_EXPORT = const MessageKind( | 75 'Warning: Unreachable code.'); |
| 76 'duplicate export of #{name}'); | 76 |
| 77 static const NOT_A_TYPE = const MessageKind( | 77 static const MessageKind MISSING_RETURN = const MessageKind( |
| 78 '#{node} is not a type'); | 78 'Warning: Missing return.'); |
| 79 static const NOT_A_PREFIX = const MessageKind( | 79 |
| 80 '#{node} is not a prefix'); | 80 static const MessageKind MAYBE_MISSING_RETURN = const MessageKind( |
| 81 static const NO_SUPER_IN_OBJECT = const MessageKind( | 81 'Warning: Not all paths lead to a return or throw statement.'); |
| 82 "'Object' does not have a superclass"); | 82 |
| 83 static const CANNOT_FIND_CONSTRUCTOR = const MessageKind( | 83 static const DualKind CANNOT_RESOLVE = const DualKind( |
| 84 'cannot find constructor #{constructorName}'); | 84 error: const MessageKind('Error: Cannot resolve "#{name}".'), |
| 85 static const CYCLIC_CLASS_HIERARCHY = const MessageKind( | 85 warning: const MessageKind('Warning: Cannot resolve "#{name}".')); |
| 86 '#{className} creates a cycle in the class hierarchy'); | 86 |
| 87 static const INVALID_RECEIVER_IN_INITIALIZER = const MessageKind( | 87 static const MessageKind CANNOT_RESOLVE_CONSTRUCTOR = const MessageKind( |
| 88 'field initializer expected'); | 88 'Error: Cannot resolve constructor "#{constructorName}".'); |
| 89 static const NO_SUPER_IN_STATIC = const MessageKind( | 89 |
| 90 "'super' is only available in instance methods"); | 90 static const MessageKind CANNOT_RESOLVE_CONSTRUCTOR_FOR_IMPLICIT = |
| 91 static const DUPLICATE_INITIALIZER = const MessageKind( | 91 const MessageKind( |
| 92 'field #{fieldName} is initialized more than once'); | 92 'Error: cannot resolve constructor "#{constructorName}" for implicit' |
| 93 static const ALREADY_INITIALIZED = const MessageKind( | 93 'super call.'); |
| 94 '#{fieldName} was already initialized here'); | 94 |
| 95 static const INIT_STATIC_FIELD = const MessageKind( | 95 static const MessageKind INVALID_UNNAMED_CONSTRUCTOR_NAME = const MessageKind( |
| 96 'cannot initialize static field #{fieldName}'); | 96 'Error: Unnamed constructor name must be "#{name}".'); |
| 97 static const NOT_A_FIELD = const MessageKind( | 97 |
| 98 '#{fieldName} is not a field'); | 98 static const MessageKind INVALID_CONSTRUCTOR_NAME = const MessageKind( |
| 99 static const CONSTRUCTOR_CALL_EXPECTED = const MessageKind( | 99 'Error: Constructor name must start with "#{name}".'); |
| 100 "only call to 'this' or 'super' constructor allowed"); | 100 |
| 101 static const INVALID_FOR_IN = const MessageKind( | 101 static const DualKind CANNOT_RESOLVE_TYPE = const DualKind( |
| 102 'invalid for-in variable declaration.'); | 102 error: const MessageKind('Error: Cannot resolve type "#{typeName}".'), |
| 103 static const INVALID_INITIALIZER = const MessageKind( | 103 warning: const MessageKind( |
| 104 'invalid initializer'); | 104 'Warning: Cannot resolve type "#{typeName}".')); |
| 105 static const FUNCTION_WITH_INITIALIZER = const MessageKind( | 105 |
| 106 'only constructors can have initializers'); | 106 static const MessageKind DUPLICATE_DEFINITION = const MessageKind( |
| 107 static const REDIRECTING_CONSTRUCTOR_CYCLE = const MessageKind( | 107 'Error: Duplicate definition of "#{name}".'); |
| 108 'cyclic constructor redirection'); | 108 |
| 109 static const REDIRECTING_CONSTRUCTOR_HAS_BODY = const MessageKind( | 109 static const MessageKind EXISTING_DEFINITION = const MessageKind( |
| 110 'redirecting constructor cannot have a body'); | 110 'Info: Existing definition of "#{name}".'); |
| 111 static const REDIRECTING_CONSTRUCTOR_HAS_INITIALIZER = const MessageKind( | 111 |
| 112 'redirecting constructor cannot have other initializers'); | 112 static const DualKind DUPLICATE_IMPORT = const DualKind( |
| 113 static const SUPER_INITIALIZER_IN_OBJECT = const MessageKind( | 113 error: const MessageKind('Error: Duplicate import of "#{name}".'), |
| 114 "'Object' cannot have a super initializer"); | 114 warning: const MessageKind('Warning: Duplicate import of "#{name}".')); |
| 115 static const DUPLICATE_SUPER_INITIALIZER = const MessageKind( | 115 |
| 116 'cannot have more than one super initializer'); | 116 static const MessageKind DUPLICATE_EXPORT = const MessageKind( |
| 117 static const INVALID_ARGUMENTS = const MessageKind( | 117 'Error: Duplicate export of "#{name}".'); |
| 118 "arguments do not match the expected parameters of #{methodName}"); | 118 |
| 119 static const NO_MATCHING_CONSTRUCTOR = const MessageKind( | 119 static const DualKind NOT_A_TYPE = const DualKind( |
| 120 "super call arguments and constructor parameters don't match"); | 120 error: const MessageKind('Error: "#{node}" is not a type.'), |
| 121 static const NO_MATCHING_CONSTRUCTOR_FOR_IMPLICIT = const MessageKind( | 121 warning: const MessageKind('Warning: "#{node}" is not a type.')); |
| 122 "implicit super call arguments and constructor parameters don't match"); | 122 |
| 123 static const CONST_CALLS_NON_CONST = const MessageKind( | 123 static const MessageKind NOT_A_PREFIX = const MessageKind( |
| 124 "const constructor cannot call a non-const constructor"); | 124 'Error: "#{node}" is not a prefix.'); |
| 125 static const INITIALIZING_FORMAL_NOT_ALLOWED = const MessageKind( | 125 |
| 126 'an initializing formal parameter is only allowed in ' | 126 static const DualKind CANNOT_FIND_CONSTRUCTOR = const DualKind( |
| 127 'non-redirecting generative constructors'); | 127 error: const MessageKind( |
| 128 static const INVALID_PARAMETER = const MessageKind( | 128 'Error: Cannot find constructor "#{constructorName}".'), |
| 129 "cannot resolve parameter"); | 129 warning: const MessageKind( |
| 130 static const NOT_INSTANCE_FIELD = const MessageKind( | 130 'Warning: Cannot find constructor "#{constructorName}".')); |
| 131 '#{fieldName} is not an instance field'); | 131 |
| 132 static const NO_CATCH_NOR_FINALLY = const MessageKind( | 132 static const MessageKind CYCLIC_CLASS_HIERARCHY = const MessageKind( |
| 133 "expected 'catch' or 'finally'"); | 133 'Error: "#{className}" creates a cycle in the class hierarchy.'); |
| 134 static const EMPTY_CATCH_DECLARATION = const MessageKind( | 134 |
| 135 'expected an identifier in catch declaration'); | 135 static const MessageKind INVALID_RECEIVER_IN_INITIALIZER = const MessageKind( |
| 136 static const EXTRA_CATCH_DECLARATION = const MessageKind( | 136 'Error: Field initializer expected.'); |
| 137 'extra parameter in catch declaration'); | 137 |
| 138 static const PARAMETER_WITH_TYPE_IN_CATCH = const MessageKind( | 138 static const MessageKind NO_SUPER_IN_STATIC = const MessageKind( |
| 139 'cannot use type annotations in catch'); | 139 'Error: "super" is only available in instance methods.'); |
| 140 static const PARAMETER_WITH_MODIFIER_IN_CATCH = const MessageKind( | 140 |
| 141 'cannot use modifiers in catch'); | 141 static const MessageKind DUPLICATE_INITIALIZER = const MessageKind( |
| 142 static const OPTIONAL_PARAMETER_IN_CATCH = const MessageKind( | 142 'Error: Field "#{fieldName}" is initialized more than once.'); |
| 143 'cannot use optional parameters in catch'); | 143 |
| 144 static const THROW_WITHOUT_EXPRESSION = const MessageKind( | 144 static const MessageKind ALREADY_INITIALIZED = const MessageKind( |
| 145 'cannot use re-throw outside of catch block (expression expected after ' | 145 'Info: "#{fieldName}" was already initialized here.'); |
| 146 '"throw")'); | 146 |
| 147 static const UNBOUND_LABEL = const MessageKind( | 147 static const MessageKind INIT_STATIC_FIELD = const MessageKind( |
| 148 'cannot resolve label #{labelName}'); | 148 'Error: Cannot initialize static field "#{fieldName}".'); |
| 149 static const NO_BREAK_TARGET = const MessageKind( | 149 |
| 150 'break statement not inside switch or loop'); | 150 static const MessageKind NOT_A_FIELD = const MessageKind( |
| 151 static const NO_CONTINUE_TARGET = const MessageKind( | 151 'Error: "#{fieldName}" is not a field.'); |
| 152 'continue statement not inside loop'); | 152 |
| 153 static const EXISTING_LABEL = const MessageKind( | 153 static const MessageKind CONSTRUCTOR_CALL_EXPECTED = const MessageKind( |
| 154 'original declaration of duplicate label #{labelName}'); | 154 'Error: only call to "this" or "super" constructor allowed.'); |
| 155 static const DUPLICATE_LABEL = const MessageKind( | 155 |
| 156 'duplicate declaration of label #{labelName}'); | 156 static const MessageKind INVALID_FOR_IN = const MessageKind( |
| 157 static const UNUSED_LABEL = const MessageKind( | 157 'Error: Invalid for-in variable declaration.'); |
| 158 'unused label #{labelName}'); | 158 |
| 159 static const INVALID_CONTINUE = const MessageKind( | 159 static const MessageKind INVALID_INITIALIZER = const MessageKind( |
| 160 'target of continue is not a loop or switch case'); | 160 'Error: Invalid initializer.'); |
| 161 static const INVALID_BREAK = const MessageKind( | 161 |
| 162 'target of break is not a statement'); | 162 static const MessageKind FUNCTION_WITH_INITIALIZER = const MessageKind( |
| 163 | 163 'Error: Only constructors can have initializers.'); |
| 164 static const TYPE_VARIABLE_AS_CONSTRUCTOR = const MessageKind( | 164 |
| 165 'cannot use type variable as constructor'); | 165 static const MessageKind REDIRECTING_CONSTRUCTOR_CYCLE = const MessageKind( |
| 166 static const DUPLICATE_TYPE_VARIABLE_NAME = const MessageKind( | 166 'Error: Cyclic constructor redirection.'); |
| 167 'type variable #{typeVariableName} already declared'); | 167 |
| 168 static const TYPE_VARIABLE_WITHIN_STATIC_MEMBER = const MessageKind( | 168 static const MessageKind REDIRECTING_CONSTRUCTOR_HAS_BODY = const MessageKind( |
| 169 'cannot refer to type variable #{typeVariableName} ' | 169 'Error: Redirecting constructor cannot have a body.'); |
| 170 'within a static member'); | 170 |
| 171 static const TYPE_VARIABLE_IN_CONSTANT = const MessageKind( | 171 static const MessageKind REDIRECTING_CONSTRUCTOR_HAS_INITIALIZER = |
| 172 'Error: cannot refer to type variable in constant'); | 172 const MessageKind( |
| 173 | 173 'Error: Redirecting constructor cannot have other initializers.'); |
| 174 static const INVALID_USE_OF_SUPER = const MessageKind( | 174 |
| 175 'super not allowed here'); | 175 static const MessageKind SUPER_INITIALIZER_IN_OBJECT = const MessageKind( |
| 176 static const INVALID_CASE_DEFAULT = const MessageKind( | 176 'Error: "Object" cannot have a super initializer.'); |
| 177 'default only allowed on last case of a switch'); | 177 |
| 178 | 178 static const MessageKind DUPLICATE_SUPER_INITIALIZER = const MessageKind( |
| 179 static const SWITCH_CASE_TYPES_NOT_EQUAL = const MessageKind( | 179 'Error: Cannot have more than one super initializer.'); |
| 180 "case expressions don't all have the same type."); | 180 |
| 181 static const SWITCH_CASE_VALUE_OVERRIDES_EQUALS = const MessageKind( | 181 static const DualKind INVALID_ARGUMENTS = const DualKind( |
| 182 "case expression value overrides 'operator=='."); | 182 error: const MessageKind( |
| 183 static const SWITCH_INVALID = const MessageKind( | 183 'Error: Arguments do not match the expected parameters of ' |
| 184 "switch cases contain invalid expressions."); | 184 '"#{methodName}".'), |
| 185 | 185 warning: const MessageKind( |
| 186 static const INVALID_ARGUMENT_AFTER_NAMED = const MessageKind( | 186 'Warning: Arguments do not match the expected parameters of ' |
| 187 'non-named argument after named argument'); | 187 '"#{methodName}".')); |
| 188 | 188 |
| 189 static const NOT_A_COMPILE_TIME_CONSTANT = const MessageKind( | 189 static const MessageKind NO_MATCHING_CONSTRUCTOR = const MessageKind( |
| 190 'not a compile-time constant'); | 190 'Error: "super" call arguments and constructor parameters do not match.'); |
| 191 static const CYCLIC_COMPILE_TIME_CONSTANTS = const MessageKind( | 191 |
| 192 'cycle in the compile-time constant computation'); | 192 static const MessageKind NO_MATCHING_CONSTRUCTOR_FOR_IMPLICIT = |
| 193 static const CONSTRUCTOR_IS_NOT_CONST = const MessageKind( | 193 const MessageKind( |
| 194 'constructor is not a const constructor'); | 194 'Error: Implicit super call arguments and constructor parameters ' |
| 195 | 195 'do not match.'); |
| 196 static const KEY_NOT_A_STRING_LITERAL = const MessageKind( | 196 |
| 197 'map-literal key not a string literal'); | 197 static const MessageKind CONST_CALLS_NON_CONST = const MessageKind( |
| 198 | 198 'Error: "const" constructor cannot call a non-const constructor.'); |
| 199 static const NO_SUCH_LIBRARY_MEMBER = const MessageKind( | 199 |
| 200 '#{libraryName} has no member named #{memberName}'); | 200 static const MessageKind INITIALIZING_FORMAL_NOT_ALLOWED = const MessageKind( |
| 201 | 201 'Error: Initializing formal parameter only allowed in generative ' |
| 202 static const CANNOT_INSTANTIATE_TYPEDEF = const MessageKind( | 202 'constructor.'); |
| 203 "cannot instantiate typedef '#{typedefName}'"); | 203 |
| 204 | 204 static const MessageKind INVALID_PARAMETER = const MessageKind( |
| 205 static const CANNOT_INSTANTIATE_TYPE_VARIABLE = const MessageKind( | 205 'Error: Cannot resolve parameter.'); |
| 206 "cannot instantiate type variable '#{typeVariableName}'"); | 206 |
| 207 | 207 static const MessageKind NOT_INSTANCE_FIELD = const MessageKind( |
| 208 static const NO_DEFAULT_CLASS = const MessageKind( | 208 'Error: "#{fieldName}" is not an instance field.'); |
| 209 "no default class on enclosing interface '#{interfaceName}'"); | 209 |
| 210 | 210 static const MessageKind NO_CATCH_NOR_FINALLY = const MessageKind( |
| 211 static const CYCLIC_TYPE_VARIABLE = const MessageKind( | 211 'Error: Expected "catch" or "finally".'); |
| 212 "type variable #{typeVariableName} is a supertype of itself"); | 212 |
| 213 | 213 static const MessageKind EMPTY_CATCH_DECLARATION = const MessageKind( |
| 214 static const CLASS_NAME_EXPECTED = const MessageKind( | 214 'Error: Expected an identifier in catch declaration.'); |
| 215 "class name expected"); | 215 |
| 216 | 216 static const MessageKind EXTRA_CATCH_DECLARATION = const MessageKind( |
| 217 static const INTERFACE_TYPE_EXPECTED = const MessageKind( | 217 'Error: Extra parameter in catch declaration.'); |
| 218 "interface type expected"); | 218 |
| 219 | 219 static const MessageKind PARAMETER_WITH_TYPE_IN_CATCH = const MessageKind( |
| 220 static const CANNOT_EXTEND = const MessageKind( | 220 'Error: Cannot use type annotations in catch.'); |
| 221 "#{type} cannot be extended"); | 221 |
| 222 | 222 static const MessageKind PARAMETER_WITH_MODIFIER_IN_CATCH = const MessageKind( |
| 223 static const CANNOT_IMPLEMENT = const MessageKind( | 223 'Error: Cannot use modifiers in catch.'); |
| 224 "#{type} cannot be implemented"); | 224 |
| 225 | 225 static const MessageKind OPTIONAL_PARAMETER_IN_CATCH = const MessageKind( |
| 226 static const DUPLICATE_EXTENDS_IMPLEMENTS = const MessageKind( | 226 'Error: Cannot use optional parameters in catch.'); |
| 227 "Error: #{type} can not be both extended and implemented."); | 227 |
| 228 | 228 static const MessageKind THROW_WITHOUT_EXPRESSION = const MessageKind( |
| 229 static const DUPLICATE_IMPLEMENTS = const MessageKind( | 229 'Error: Cannot use re-throw outside of catch block ' |
| 230 "Error: #{type} must not occur more than once " | 230 '(expression expected after "throw").'); |
| 231 "in the implements clause."); | 231 |
| 232 | 232 static const MessageKind UNBOUND_LABEL = const MessageKind( |
| 233 static const ILLEGAL_SUPER_SEND = const MessageKind( | 233 'Error: Cannot resolve label "#{labelName}".'); |
| 234 "#{name} cannot be called on super"); | 234 |
| 235 | 235 static const MessageKind NO_BREAK_TARGET = const MessageKind( |
| 236 static const NO_SUCH_SUPER_MEMBER = const MessageKind( | 236 'Error: "break" statement not inside switch or loop.'); |
| 237 "Cannot resolve #{memberName} in a superclass of #{className}"); | 237 |
| 238 | 238 static const MessageKind NO_CONTINUE_TARGET = const MessageKind( |
| 239 static const ADDITIONAL_TYPE_ARGUMENT = const MessageKind( | 239 'Error: "continue" statement not inside loop.'); |
| 240 "additional type argument"); | 240 |
| 241 | 241 static const MessageKind EXISTING_LABEL = const MessageKind( |
| 242 static const MISSING_TYPE_ARGUMENT = const MessageKind( | 242 'Info: Original declaration of duplicate label "#{labelName}".'); |
| 243 "missing type argument"); | 243 |
| 244 static const DualKind DUPLICATE_LABEL = const DualKind( | |
| 245 error: const MessageKind( | |
| 246 'Error: Duplicate declaration of label "#{labelName}".'), | |
| 247 warning: const MessageKind( | |
| 248 'Warning: Duplicate declaration of label "#{labelName}".')); | |
| 249 | |
| 250 static const MessageKind UNUSED_LABEL = const MessageKind( | |
| 251 'Warning: Unused label "#{labelName}".'); | |
| 252 | |
| 253 static const MessageKind INVALID_CONTINUE = const MessageKind( | |
| 254 'Error: Target of continue is not a loop or switch case.'); | |
| 255 | |
| 256 static const MessageKind INVALID_BREAK = const MessageKind( | |
| 257 'Error: Target of break is not a statement.'); | |
| 258 | |
| 259 static const MessageKind DUPLICATE_TYPE_VARIABLE_NAME = const MessageKind( | |
| 260 'Error: Type variable "#{typeVariableName}" already declared.'); | |
| 261 | |
| 262 static const DualKind TYPE_VARIABLE_WITHIN_STATIC_MEMBER = const DualKind( | |
| 263 error: const MessageKind( | |
| 264 'Error: Cannot refer to type variable "#{typeVariableName}" ' | |
| 265 'within a static member.'), | |
| 266 warning: const MessageKind( | |
| 267 'Warning: Cannot refer to type variable "#{typeVariableName}" ' | |
| 268 'within a static member.')); | |
| 269 | |
| 270 static const MessageKind TYPE_VARIABLE_IN_CONSTANT = const MessageKind( | |
| 271 'Error: Cannot refer to type variable in constant.'); | |
| 272 | |
| 273 static const MessageKind INVALID_USE_OF_SUPER = const MessageKind( | |
| 274 'Error: "super" not allowed here.'); | |
| 275 | |
| 276 static const MessageKind INVALID_CASE_DEFAULT = const MessageKind( | |
| 277 'Error: "default" only allowed on last case of a switch.'); | |
| 278 | |
| 279 static const MessageKind SWITCH_CASE_TYPES_NOT_EQUAL = const MessageKind( | |
| 280 'Error: "case" expressions do not all have the same type.'); | |
| 281 | |
| 282 static const MessageKind SWITCH_CASE_VALUE_OVERRIDES_EQUALS = | |
| 283 const MessageKind( | |
| 284 'Error: "case" expression value overrides "operator==".'); | |
| 285 | |
| 286 static const MessageKind INVALID_ARGUMENT_AFTER_NAMED = const MessageKind( | |
| 287 'Error: Unnamed argument after named argument.'); | |
| 288 | |
| 289 static const MessageKind NOT_A_COMPILE_TIME_CONSTANT = const MessageKind( | |
| 290 'Error: Not a compile-time constant.'); | |
| 291 | |
| 292 static const MessageKind CYCLIC_COMPILE_TIME_CONSTANTS = const MessageKind( | |
| 293 'Error: Cycle in the compile-time constant computation.'); | |
| 294 | |
| 295 static const MessageKind CONSTRUCTOR_IS_NOT_CONST = const MessageKind( | |
| 296 'Error: Constructor is not a "const" constructor.'); | |
| 297 | |
| 298 static const MessageKind KEY_NOT_A_STRING_LITERAL = const MessageKind( | |
| 299 'Error: Map-literal key not a string literal.'); | |
| 300 | |
| 301 static const DualKind NO_SUCH_LIBRARY_MEMBER = const DualKind( | |
| 302 error: const MessageKind( | |
| 303 'Error: "#{libraryName}" has no member named "#{memberName}".'), | |
| 304 warning: const MessageKind( | |
| 305 'Warning: "#{libraryName}" has no member named "#{memberName}".')); | |
| 306 | |
| 307 static const MessageKind CANNOT_INSTANTIATE_TYPEDEF = const MessageKind( | |
| 308 'Error: Cannot instantiate typedef "#{typedefName}".'); | |
| 309 | |
| 310 static const MessageKind CANNOT_INSTANTIATE_TYPE_VARIABLE = const MessageKind( | |
| 311 'Error: Cannot instantiate type variable "#{typeVariableName}".'); | |
| 312 | |
| 313 static const MessageKind CYCLIC_TYPE_VARIABLE = const MessageKind( | |
| 314 'Warning: Type variable "#{typeVariableName}" is a supertype of itself.'); | |
| 315 | |
| 316 static const MessageKind CLASS_NAME_EXPECTED = const MessageKind( | |
| 317 'Error: Class name expected.'); | |
| 318 | |
| 319 static const MessageKind CANNOT_EXTEND = const MessageKind( | |
| 320 'Error: "#{type}" cannot be extended.'); | |
| 321 | |
| 322 static const MessageKind CANNOT_IMPLEMENT = const MessageKind( | |
| 323 'Error: "#{type}" cannot be implemented.'); | |
| 324 | |
| 325 static const MessageKind DUPLICATE_EXTENDS_IMPLEMENTS = const MessageKind( | |
| 326 'Error: "#{type}" can not be both extended and implemented.'); | |
| 327 | |
| 328 static const MessageKind DUPLICATE_IMPLEMENTS = const MessageKind( | |
| 329 'Error: "#{type}" must not occur more than once ' | |
| 330 'in the implements clause.'); | |
| 331 | |
| 332 static const MessageKind ILLEGAL_SUPER_SEND = const MessageKind( | |
| 333 'Error: "#{name}" cannot be called on super.'); | |
| 334 | |
| 335 static const DualKind NO_SUCH_SUPER_MEMBER = const DualKind( | |
| 336 error: const MessageKind( | |
| 337 'Error: Cannot resolve "#{memberName}" in a superclass of ' | |
| 338 '"#{className}".'), | |
| 339 warning: const MessageKind( | |
| 340 'Warning: Cannot resolve "#{memberName}" in a superclass of ' | |
| 341 '"#{className}".')); | |
| 342 | |
| 343 static const DualKind ADDITIONAL_TYPE_ARGUMENT = const DualKind( | |
| 344 error: const MessageKind('Error: Additional type argument.'), | |
| 345 warning: const MessageKind('Warning: Additional type argument.')); | |
| 346 | |
| 347 static const DualKind MISSING_TYPE_ARGUMENT = const DualKind( | |
| 348 error: const MessageKind('Error: Missing type argument.'), | |
| 349 warning: const MessageKind('Warning: Missing type argument.')); | |
| 244 | 350 |
| 245 // TODO(johnniwinther): Use ADDITIONAL_TYPE_ARGUMENT or MISSING_TYPE_ARGUMENT | 351 // TODO(johnniwinther): Use ADDITIONAL_TYPE_ARGUMENT or MISSING_TYPE_ARGUMENT |
| 246 // instead. | 352 // instead. |
| 247 static const TYPE_ARGUMENT_COUNT_MISMATCH = const MessageKind( | 353 static const MessageKind TYPE_ARGUMENT_COUNT_MISMATCH = const MessageKind( |
| 248 "incorrect number of type arguments on #{type}"); | 354 'Error: Incorrect number of type arguments on "#{type}".'); |
| 249 | 355 |
| 250 static const MISSING_ARGUMENTS_TO_ASSERT = const MessageKind( | 356 static const MessageKind GETTER_MISMATCH = const MessageKind( |
| 251 "missing arguments to assert"); | 357 'Error: Setter disagrees on: "#{modifiers}".'); |
| 252 | 358 |
| 253 static const GETTER_MISMATCH = const MessageKind( | 359 static const MessageKind SETTER_MISMATCH = const MessageKind( |
| 254 "Error: setter disagrees on: #{modifiers}."); | 360 'Error: Getter disagrees on: "#{modifiers}".'); |
| 255 | 361 |
| 256 static const SETTER_MISMATCH = const MessageKind( | 362 static const MessageKind ILLEGAL_SETTER_FORMALS = const MessageKind( |
| 257 "Error: getter disagrees on: #{modifiers}."); | 363 'Error: A setter must have exactly one argument.'); |
| 258 | 364 |
| 259 static const ILLEGAL_SETTER_FORMALS = const MessageKind( | 365 static const MessageKind NO_STATIC_OVERRIDE = const MessageKind( |
| 260 "Error: a setter must have exactly one argument."); | 366 'Error: Static member cannot override instance member "#{memberName}" of ' |
| 261 | 367 '"#{className}".'); |
| 262 static const NO_STATIC_OVERRIDE = const MessageKind( | 368 |
| 263 "Error: static member cannot override instance member '#{memberName}' of " | 369 static const MessageKind NO_STATIC_OVERRIDE_CONT = const MessageKind( |
| 264 "'#{className}'."); | 370 'Info: This is the instance member that cannot be overridden ' |
| 265 | 371 'by a static member.'); |
| 266 static const NO_STATIC_OVERRIDE_CONT = const MessageKind( | 372 |
| 267 "Info: this is the instance member that cannot be overridden " | 373 static const MessageKind CANNOT_OVERRIDE_FIELD_WITH_METHOD = |
| 268 "by a static member."); | 374 const MessageKind( |
| 269 | 375 'Error: Method cannot override field "#{memberName}" of ' |
| 270 static const CANNOT_OVERRIDE_FIELD_WITH_METHOD = const MessageKind( | 376 '"#{className}".'); |
| 271 "Error: method cannot override field '#{memberName}' of '#{className}'."); | 377 |
| 272 | 378 static const MessageKind CANNOT_OVERRIDE_FIELD_WITH_METHOD_CONT = |
| 273 static const CANNOT_OVERRIDE_FIELD_WITH_METHOD_CONT = const MessageKind( | 379 const MessageKind( |
| 274 "Info: this is the field that cannot be overridden by a method."); | 380 'Info: This is the field that cannot be overridden by a method.'); |
| 275 | 381 |
| 276 static const CANNOT_OVERRIDE_METHOD_WITH_FIELD = const MessageKind( | 382 static const MessageKind CANNOT_OVERRIDE_METHOD_WITH_FIELD = |
| 277 "Error: field cannot override method '#{memberName}' of '#{className}'."); | 383 const MessageKind( |
| 278 | 384 'Error: Field cannot override method "#{memberName}" of ' |
| 279 static const CANNOT_OVERRIDE_METHOD_WITH_FIELD_CONT = const MessageKind( | 385 '"#{className}".'); |
| 280 "Info: this is the method that cannot be overridden by a field."); | 386 |
| 281 | 387 static const MessageKind CANNOT_OVERRIDE_METHOD_WITH_FIELD_CONT = |
| 282 static const BAD_ARITY_OVERRIDE = const MessageKind( | 388 const MessageKind( |
| 283 "Error: cannot override method '#{memberName}' in '#{className}'; " | 389 'Info: This is the method that cannot be overridden by a field.'); |
| 284 "the parameters do not match."); | 390 |
| 285 | 391 static const MessageKind BAD_ARITY_OVERRIDE = const MessageKind( |
| 286 static const BAD_ARITY_OVERRIDE_CONT = const MessageKind( | 392 'Error: Cannot override method "#{memberName}" in "#{className}"; ' |
| 287 "Info: this is the method whose parameters do not match."); | 393 'the parameters do not match.'); |
| 288 | 394 |
| 289 static const MISSING_FORMALS = const MessageKind( | 395 static const MessageKind BAD_ARITY_OVERRIDE_CONT = const MessageKind( |
| 290 "Error: Formal parameters are missing."); | 396 'Info: This is the method whose parameters do not match.'); |
| 291 | 397 |
| 292 static const EXTRA_FORMALS = const MessageKind( | 398 static const MessageKind MISSING_FORMALS = const MessageKind( |
| 293 "Error: Formal parameters are not allowed here."); | 399 'Error: Formal parameters are missing.'); |
| 294 | 400 |
| 295 static const UNARY_OPERATOR_BAD_ARITY = const MessageKind( | 401 static const MessageKind EXTRA_FORMALS = const MessageKind( |
| 296 "Error: Operator #{operatorName} must have no parameters."); | 402 'Error: Formal parameters are not allowed here.'); |
| 297 | 403 |
| 298 static const MINUS_OPERATOR_BAD_ARITY = const MessageKind( | 404 static const MessageKind UNARY_OPERATOR_BAD_ARITY = const MessageKind( |
| 299 "Error: Operator - must have 0 or 1 parameters."); | 405 'Error: Operator "#{operatorName}" must have no parameters.'); |
| 300 | 406 |
| 301 static const BINARY_OPERATOR_BAD_ARITY = const MessageKind( | 407 static const MessageKind MINUS_OPERATOR_BAD_ARITY = const MessageKind( |
| 302 "Error: Operator #{operatorName} must have exactly 1 parameter."); | 408 'Error: Operator "-" must have 0 or 1 parameters.'); |
| 303 | 409 |
| 304 static const TERNARY_OPERATOR_BAD_ARITY = const MessageKind( | 410 static const MessageKind BINARY_OPERATOR_BAD_ARITY = const MessageKind( |
| 305 "Error: Operator #{operatorName} must have exactly 2 parameters."); | 411 'Error: Operator "#{operatorName}" must have exactly 1 parameter.'); |
| 306 | 412 |
| 307 static const OPERATOR_OPTIONAL_PARAMETERS = const MessageKind( | 413 static const MessageKind TERNARY_OPERATOR_BAD_ARITY = const MessageKind( |
| 308 "Error: Operator #{operatorName} cannot have optional parameters."); | 414 'Error: Operator "#{operatorName}" must have exactly 2 parameters.'); |
| 309 | 415 |
| 310 static const OPERATOR_NAMED_PARAMETERS = const MessageKind( | 416 static const MessageKind OPERATOR_OPTIONAL_PARAMETERS = const MessageKind( |
| 311 "Error: Operator #{operatorName} cannot have named parameters."); | 417 'Error: Operator "#{operatorName}" cannot have optional parameters.'); |
| 418 | |
| 419 static const MessageKind OPERATOR_NAMED_PARAMETERS = const MessageKind( | |
| 420 'Error: Operator "#{operatorName}" cannot have named parameters.'); | |
| 312 | 421 |
| 313 // TODO(ahe): This message is hard to localize. This is acceptable, | 422 // TODO(ahe): This message is hard to localize. This is acceptable, |
| 314 // as it will be removed when we ship Dart version 1.0. | 423 // as it will be removed when we ship Dart version 1.0. |
| 315 static const DEPRECATED_FEATURE_WARNING = const MessageKind( | 424 static const MessageKind DEPRECATED_FEATURE_WARNING = const MessageKind( |
| 316 "Warning: deprecated language feature, #{featureName}, " | 425 'Warning: Deprecated language feature, #{featureName}, ' |
| 317 "will be removed in a future Dart milestone."); | 426 'will be removed in a future Dart milestone.'); |
| 318 | 427 |
| 319 // TODO(ahe): This message is hard to localize. This is acceptable, | 428 // TODO(ahe): This message is hard to localize. This is acceptable, |
| 320 // as it will be removed when we ship Dart version 1.0. | 429 // as it will be removed when we ship Dart version 1.0. |
| 321 static const DEPRECATED_FEATURE_ERROR = const MessageKind( | 430 static const MessageKind DEPRECATED_FEATURE_ERROR = const MessageKind( |
| 322 "Error: #{featureName} are not legal " | 431 'Error: #{featureName} are not legal ' |
| 323 "due to option --reject-deprecated-language-features."); | 432 'due to option --reject-deprecated-language-features.'); |
| 324 | 433 |
| 325 static const CONSTRUCTOR_WITH_RETURN_TYPE = const MessageKind( | 434 static const MessageKind CONSTRUCTOR_WITH_RETURN_TYPE = const MessageKind( |
| 326 "Error: cannot have return type for constructor."); | 435 'Error: Cannot have return type for constructor.'); |
| 327 | 436 |
| 328 static const ILLEGAL_FINAL_METHOD_MODIFIER = const MessageKind( | 437 static const MessageKind ILLEGAL_FINAL_METHOD_MODIFIER = const MessageKind( |
| 329 "Error: cannot have final modifier on method."); | 438 'Error: Cannot have final modifier on method.'); |
| 330 | 439 |
| 331 static const ILLEGAL_CONSTRUCTOR_MODIFIERS = const MessageKind( | 440 static const MessageKind ILLEGAL_CONSTRUCTOR_MODIFIERS = const MessageKind( |
| 332 "Error: illegal constructor modifiers: #{modifiers}."); | 441 'Error: Illegal constructor modifiers: "#{modifiers}".'); |
| 333 | 442 |
| 334 static const ILLEGAL_MIXIN_APPLICATION_MODIFIERS = const MessageKind( | 443 static const MessageKind ILLEGAL_MIXIN_APPLICATION_MODIFIERS = |
| 335 "Error: illegal mixin application modifiers: #{modifiers}."); | 444 const MessageKind( |
| 336 | 445 'Error: Illegal mixin application modifiers: "#{modifiers}".'); |
| 337 static const ILLEGAL_MIXIN_SUPERCLASS = const MessageKind( | 446 |
| 338 "Error: class used as mixin must have Object as superclass."); | 447 static const MessageKind ILLEGAL_MIXIN_SUPERCLASS = const MessageKind( |
| 339 | 448 'Error: Class used as mixin must have Object as superclass.'); |
| 340 static const ILLEGAL_MIXIN_OBJECT = const MessageKind( | 449 |
| 341 "Error: cannot use Object as mixin."); | 450 static const MessageKind ILLEGAL_MIXIN_OBJECT = const MessageKind( |
| 342 | 451 'Error: Cannot use Object as mixin.'); |
| 343 static const ILLEGAL_MIXIN_CONSTRUCTOR = const MessageKind( | 452 |
| 344 "Error: class used as mixin cannot have non-factory constructor."); | 453 static const MessageKind ILLEGAL_MIXIN_CONSTRUCTOR = const MessageKind( |
| 345 | 454 'Error: Class used as mixin cannot have non-factory constructor.'); |
| 346 static const ILLEGAL_MIXIN_CYCLE = const MessageKind( | 455 |
| 347 "Error: class used as mixin introduces mixin cycle: " | 456 static const MessageKind ILLEGAL_MIXIN_CYCLE = const MessageKind( |
| 348 "#{mixinName1} <-> #{mixinName2}."); | 457 'Error: Class used as mixin introduces mixin cycle: ' |
| 349 | 458 '"#{mixinName1}" <-> "#{mixinName2}".'); |
| 350 static const ILLEGAL_MIXIN_WITH_SUPER = const MessageKind( | 459 |
| 351 "Error: cannot use class #{className} as a mixin because it uses super."); | 460 static const MessageKind ILLEGAL_MIXIN_WITH_SUPER = const MessageKind( |
| 352 | 461 'Error: Cannot use class "#{className}" as a mixin because it uses super.' ); |
|
kustermann
2013/07/27 09:50:29
Move it to the end of the previous line.
ahe
2013/07/28 09:05:51
Done.
| |
| 353 static const ILLEGAL_MIXIN_SUPER_USE = const MessageKind( | 462 |
| 354 "Use of super in class used as mixin."); | 463 static const MessageKind ILLEGAL_MIXIN_SUPER_USE = const MessageKind( |
| 355 | 464 'Info: Use of "super" in class used as mixin.'); |
| 356 static const PARAMETER_NAME_EXPECTED = const MessageKind( | 465 |
| 357 "Error: parameter name expected."); | 466 static const MessageKind PARAMETER_NAME_EXPECTED = const MessageKind( |
| 358 | 467 'Error: parameter name expected.'); |
| 359 static const CANNOT_RESOLVE_GETTER = const MessageKind( | 468 |
| 360 'cannot resolve getter.'); | 469 static const DualKind CANNOT_RESOLVE_GETTER = const DualKind( |
| 361 | 470 error: const MessageKind('Error: Cannot resolve getter.'), |
| 362 static const CANNOT_RESOLVE_SETTER = const MessageKind( | 471 warning: const MessageKind('Warning: Cannot resolve getter.')); |
| 363 'cannot resolve setter.'); | 472 |
| 364 | 473 static const DualKind CANNOT_RESOLVE_SETTER = const DualKind( |
| 365 static const CANNOT_RESOLVE_INDEX = const MessageKind( | 474 error: const MessageKind('Error: Cannot resolve setter.'), |
| 366 'cannot resolve [] member.'); | 475 warning: const MessageKind('Warning: Cannot resolve setter.')); |
| 367 | 476 |
| 368 static const VOID_NOT_ALLOWED = const MessageKind( | 477 static const MessageKind VOID_NOT_ALLOWED = const MessageKind( |
| 369 'type void is only allowed in a return type.'); | 478 'Error: Type "void" is only allowed in a return type.'); |
| 370 | 479 |
| 371 static const BEFORE_TOP_LEVEL = const MessageKind( | 480 static const MessageKind BEFORE_TOP_LEVEL = const MessageKind( |
| 372 'Error: part header must come before top-level definitions.'); | 481 'Error: Part header must come before top-level definitions.'); |
| 373 | 482 |
| 374 static const LIBRARY_NAME_MISMATCH = const MessageKind( | 483 static const MessageKind LIBRARY_NAME_MISMATCH = const MessageKind( |
| 375 'Warning: expected part of library name "#{libraryName}".'); | 484 'Warning: Expected part of library name "#{libraryName}".'); |
| 376 | 485 |
| 377 static const MISSING_PART_OF_TAG = const MessageKind( | 486 static const MessageKind MISSING_PART_OF_TAG = const MessageKind( |
| 378 'Note: This file has no part-of tag, but it is being used as a part.'); | 487 'Note: This file has no part-of tag, but it is being used as a part.'); |
| 379 | 488 |
| 380 static const DUPLICATED_PART_OF = const MessageKind( | 489 static const MessageKind DUPLICATED_PART_OF = const MessageKind( |
| 381 'Error: duplicated part-of directive.'); | 490 'Error: Duplicated part-of directive.'); |
| 382 | 491 |
| 383 static const ILLEGAL_DIRECTIVE = const MessageKind( | 492 static const MessageKind ILLEGAL_DIRECTIVE = const MessageKind( |
| 384 'Error: directive not allowed here.'); | 493 'Error: Directive not allowed here.'); |
| 385 | 494 |
| 386 static const DUPLICATED_LIBRARY_NAME = const MessageKind( | 495 static const MessageKind DUPLICATED_LIBRARY_NAME = const MessageKind( |
| 387 'Warning: duplicated library name "#{libraryName}".'); | 496 'Warning: Duplicated library name "#{libraryName}".'); |
| 388 | 497 |
| 389 static const INVALID_SOURCE_FILE_LOCATION = const MessageKind(''' | 498 // This is used as an exception. |
| 499 static const MessageKind INVALID_SOURCE_FILE_LOCATION = const MessageKind(''' | |
| 390 Invalid offset (#{offset}) in source map. | 500 Invalid offset (#{offset}) in source map. |
| 391 File: #{fileName} | 501 File: #{fileName} |
| 392 Length: #{length}'''); | 502 Length: #{length}'''); |
| 393 | 503 |
| 394 static const TOP_LEVEL_VARIABLE_DECLARED_STATIC = const MessageKind( | 504 static const MessageKind TOP_LEVEL_VARIABLE_DECLARED_STATIC = |
| 395 "Top-level variable cannot be declared static."); | 505 const MessageKind( |
| 396 | 506 'Error: Top-level variable cannot be declared static.'); |
| 397 static const WRONG_NUMBER_OF_ARGUMENTS_FOR_ASSERT = const MessageKind( | 507 |
| 398 "Wrong number of arguments to assert. Should be 1, but given " | 508 static const MessageKind WRONG_NUMBER_OF_ARGUMENTS_FOR_ASSERT = |
| 399 "#{argumentCount}."); | 509 const MessageKind( |
| 400 | 510 'Error: Wrong number of arguments to assert. Should be 1, but given ' |
| 401 static const ASSERT_IS_GIVEN_NAMED_ARGUMENTS = const MessageKind( | 511 '#{argumentCount}.'); |
| 402 "assert takes no named arguments, but given #{argumentCount}."); | 512 |
| 403 | 513 static const MessageKind ASSERT_IS_GIVEN_NAMED_ARGUMENTS = const MessageKind( |
| 404 static const FACTORY_REDIRECTION_IN_NON_FACTORY = const MessageKind( | 514 'Error: "assert" takes no named arguments, but given #{argumentCount}.'); |
| 405 "Error: Factory redirection only allowed in factories."); | 515 |
| 406 | 516 static const MessageKind FACTORY_REDIRECTION_IN_NON_FACTORY = |
| 407 static const MISSING_FACTORY_KEYWORD = const MessageKind( | 517 const MessageKind( |
| 408 "Did you forget a factory keyword here?"); | 518 'Error: Factory redirection only allowed in factories.'); |
| 409 | 519 |
| 410 static const DEFERRED_LIBRARY_NAME_MISMATCH = const MessageKind( | 520 static const MessageKind MISSING_FACTORY_KEYWORD = const MessageKind( |
| 411 'Error: Library name mismatch "#{expectedName}" != "#{actualName}".'); | 521 'Hint: Did you forget a factory keyword here?'); |
| 412 | 522 |
| 413 static const ILLEGAL_STATIC = const MessageKind( | 523 static const MessageKind DEFERRED_LIBRARY_NAME_MISMATCH = |
| 414 "Error: Modifier static is only allowed on functions declared in" | 524 const MessageKind( |
| 415 " a class."); | 525 'Error: Library name mismatch "#{expectedName}" != "#{actualName}".'); |
| 416 | 526 |
| 417 static const STATIC_FUNCTION_BLOAT = const MessageKind( | 527 static const MessageKind ILLEGAL_STATIC = const MessageKind( |
| 528 'Error: Modifier static is only allowed on functions declared in ' | |
| 529 'a class.'); | |
| 530 | |
| 531 static const MessageKind STATIC_FUNCTION_BLOAT = const MessageKind( | |
| 418 'Hint: Using "#{class}.#{name}" may result in larger output.'); | 532 'Hint: Using "#{class}.#{name}" may result in larger output.'); |
| 419 | 533 |
| 420 static const NON_CONST_BLOAT = const MessageKind(''' | 534 static const MessageKind NON_CONST_BLOAT = const MessageKind(''' |
| 421 Hint: Using "new #{name}" may result in larger output. | 535 Hint: Using "new #{name}" may result in larger output. |
| 422 Use "const #{name}" if possible.'''); | 536 Use "const #{name}" if possible.'''); |
| 423 | 537 |
| 424 static const STRING_EXPECTED = const MessageKind( | 538 static const MessageKind STRING_EXPECTED = const MessageKind( |
| 425 'Error: Expected a "String", but got an instance of "#{type}".'); | 539 'Error: Expected a "String", but got an instance of "#{type}".'); |
| 426 | 540 |
| 427 static const PRIVATE_IDENTIFIER = const MessageKind( | 541 static const MessageKind PRIVATE_IDENTIFIER = const MessageKind( |
| 428 'Error: "#{value}" is not a valid Symbol name because it starts with ' | 542 'Error: "#{value}" is not a valid Symbol name because it starts with ' |
| 429 '"_".'); | 543 '"_".'); |
| 430 | 544 |
| 431 static const INVALID_SYMBOL = const MessageKind(''' | 545 static const MessageKind INVALID_SYMBOL = const MessageKind(''' |
| 432 Error: "#{value}" is not a valid Symbol name because is not: | 546 Error: "#{value}" is not a valid Symbol name because is not: |
| 433 * an empty String, | 547 * an empty String, |
| 434 * a user defined operator, | 548 * a user defined operator, |
| 435 * a qualified non-private identifier optionally followed by "=", or | 549 * a qualified non-private identifier optionally followed by "=", or |
| 436 * a qualified non-private identifier followed by "." and a user-defined operato r.'''); | 550 * a qualified non-private identifier followed by "." and a user-defined ''' |
| 437 | 551 'operator.'); |
| 438 static const AMBIGUOUS_REEXPORT = const MessageKind( | 552 |
| 553 static const MessageKind AMBIGUOUS_REEXPORT = const MessageKind( | |
| 439 'Info: "#{element}" is (re)exported by multiple libraries.'); | 554 'Info: "#{element}" is (re)exported by multiple libraries.'); |
| 440 | 555 |
| 441 static const AMBIGUOUS_LOCATION = const MessageKind( | 556 static const MessageKind AMBIGUOUS_LOCATION = const MessageKind( |
| 442 'Info: "#{element}" is defined here.'); | 557 'Info: "#{element}" is defined here.'); |
| 443 | 558 |
| 444 static const IMPORTED_HERE = const MessageKind( | 559 static const MessageKind IMPORTED_HERE = const MessageKind( |
| 445 'Info: "#{element}" is imported here.'); | 560 'Info: "#{element}" is imported here.'); |
| 446 | 561 |
| 447 static const OVERRIDE_EQUALS_NOT_HASH_CODE = const MessageKind( | 562 static const MessageKind OVERRIDE_EQUALS_NOT_HASH_CODE = const MessageKind( |
| 448 'Hint: The class "#{class}" overrides "operator==", ' | 563 'Hint: The class "#{class}" overrides "operator==", ' |
| 449 'but not "get hashCode".'); | 564 'but not "get hashCode".'); |
| 450 | 565 |
| 451 static const PACKAGE_ROOT_NOT_SET = const MessageKind( | 566 static const MessageKind PACKAGE_ROOT_NOT_SET = const MessageKind( |
| 452 "Error: Cannot resolve '#{uri}'. Package root has not been set."); | 567 'Error: Cannot resolve "#{uri}". Package root has not been set.'); |
| 453 | 568 |
| 454 static const COMPILER_CRASHED = const MessageKind( | 569 static const MessageKind COMPILER_CRASHED = const MessageKind( |
| 455 "Error: The compiler crashed when compiling this element."); | 570 'Error: The compiler crashed when compiling this element.'); |
| 456 | 571 |
| 457 static const PLEASE_REPORT_THE_CRASH = const MessageKind(''' | 572 static const MessageKind PLEASE_REPORT_THE_CRASH = const MessageKind(''' |
| 458 The compiler is broken. | 573 The compiler is broken. |
| 459 | 574 |
| 460 When compiling the above element, the compiler crashed. It is not | 575 When compiling the above element, the compiler crashed. It is not |
| 461 possible to tell if this is caused by a problem in your program or | 576 possible to tell if this is caused by a problem in your program or |
| 462 not. Regardless, the compiler should not crash. | 577 not. Regardless, the compiler should not crash. |
| 463 | 578 |
| 464 The Dart team would greatly appreciate if you would take a moment to | 579 The Dart team would greatly appreciate if you would take a moment to |
| 465 report this problem at http://dartbug.com/new. | 580 report this problem at http://dartbug.com/new. |
| 466 | 581 |
| 467 Please include the following information: | 582 Please include the following information: |
| 468 | 583 |
| 469 * the name and version of your operating system, | 584 * the name and version of your operating system, |
| 470 | 585 |
| 471 * the Dart SDK build number (#{buildId}), and | 586 * the Dart SDK build number (#{buildId}), and |
| 472 | 587 |
| 473 * the entire message you see here (including the full stack trace | 588 * the entire message you see here (including the full stack trace |
| 474 below as well as the source location above). | 589 below as well as the source location above). |
| 475 '''); | 590 '''); |
| 476 | 591 |
| 477 | 592 |
| 478 ////////////////////////////////////////////////////////////////////////////// | 593 ////////////////////////////////////////////////////////////////////////////// |
| 479 // Patch errors start. | 594 // Patch errors start. |
| 480 ////////////////////////////////////////////////////////////////////////////// | 595 ////////////////////////////////////////////////////////////////////////////// |
| 481 | 596 |
| 482 static const PATCH_RETURN_TYPE_MISMATCH = const MessageKind( | 597 static const MessageKind PATCH_RETURN_TYPE_MISMATCH = const MessageKind( |
| 483 "Patch return type '#{patchReturnType}' doesn't match " | 598 'Error: Patch return type "#{patchReturnType}" does not match ' |
| 484 "'#{originReturnType}' on origin method '#{methodName}'."); | 599 '"#{originReturnType}" on origin method "#{methodName}".'); |
| 485 | 600 |
| 486 static const PATCH_REQUIRED_PARAMETER_COUNT_MISMATCH = const MessageKind( | 601 static const MessageKind PATCH_REQUIRED_PARAMETER_COUNT_MISMATCH = |
| 487 "Required parameter count of patch method (#{patchParameterCount}) " | 602 const MessageKind( |
| 488 "doesn't match parameter count on origin method '#{methodName}' " | 603 'Error: Required parameter count of patch method ' |
| 489 "(#{originParameterCount})."); | 604 '(#{patchParameterCount}) does not match parameter count on origin ' |
| 605 'method "#{methodName}" (#{originParameterCount}).'); | |
| 490 | 606 |
| 491 static const PATCH_OPTIONAL_PARAMETER_COUNT_MISMATCH = const MessageKind( | 607 static const MessageKind PATCH_OPTIONAL_PARAMETER_COUNT_MISMATCH = |
| 492 "Optional parameter count of patch method (#{patchParameterCount}) " | 608 const MessageKind( |
| 493 "doesn't match parameter count on origin method '#{methodName}' " | 609 'Error: Optional parameter count of patch method ' |
| 494 "(#{originParameterCount})."); | 610 '(#{patchParameterCount}) does not match parameter count on origin ' |
| 611 'method "#{methodName}" (#{originParameterCount}).'); | |
| 495 | 612 |
| 496 static const PATCH_OPTIONAL_PARAMETER_NAMED_MISMATCH = const MessageKind( | 613 static const MessageKind PATCH_OPTIONAL_PARAMETER_NAMED_MISMATCH = |
| 497 "Optional parameters of origin and patch method '#{methodName}' must " | 614 const MessageKind( |
| 498 "both be either named or positional."); | 615 'Error: Optional parameters of origin and patch method ' |
| 616 '"#{methodName}" must both be either named or positional.'); | |
| 499 | 617 |
| 500 static const PATCH_PARAMETER_MISMATCH = const MessageKind( | 618 static const MessageKind PATCH_PARAMETER_MISMATCH = const MessageKind( |
| 501 "Patch method parameter '#{patchParameter}' doesn't match " | 619 'Error: Patch method parameter "#{patchParameter}" does not match ' |
| 502 "'#{originParameter}' on origin method #{methodName}."); | 620 '"#{originParameter}" on origin method "#{methodName}".'); |
| 503 | 621 |
| 504 static const PATCH_PARAMETER_TYPE_MISMATCH = const MessageKind( | 622 static const MessageKind PATCH_PARAMETER_TYPE_MISMATCH = const MessageKind( |
| 505 "Patch method parameter '#{parameterName}' type #{patchParameterType} " | 623 'Error: Patch method parameter "#{parameterName}" type ' |
| 506 "doesn't match #{originParameterType} on origin method #{methodName}."); | 624 '"#{patchParameterType}" does not match "#{originParameterType}" on ' |
| 625 'origin method "#{methodName}".'); | |
| 507 | 626 |
| 508 static const PATCH_EXTERNAL_WITHOUT_IMPLEMENTATION = const MessageKind( | 627 static const MessageKind PATCH_EXTERNAL_WITHOUT_IMPLEMENTATION = |
| 509 "External method without an implementation."); | 628 const MessageKind('Error: External method without an implementation.'); |
| 510 | 629 |
| 511 static const PATCH_POINT_TO_FUNCTION = const MessageKind( | 630 static const MessageKind PATCH_POINT_TO_FUNCTION = const MessageKind( |
| 512 "Info: This is the function patch '#{functionName}'."); | 631 'Info: This is the function patch "#{functionName}".'); |
| 513 | 632 |
| 514 static const PATCH_POINT_TO_CLASS = const MessageKind( | 633 static const MessageKind PATCH_POINT_TO_CLASS = const MessageKind( |
| 515 "Info: This is the class patch '#{className}'."); | 634 'Info: This is the class patch "#{className}".'); |
| 516 | 635 |
| 517 static const PATCH_POINT_TO_GETTER = const MessageKind( | 636 static const MessageKind PATCH_POINT_TO_GETTER = const MessageKind( |
| 518 "Info: This is the getter patch '#{getterName}'."); | 637 'Info: This is the getter patch "#{getterName}".'); |
| 519 | 638 |
| 520 static const PATCH_POINT_TO_SETTER = const MessageKind( | 639 static const MessageKind PATCH_POINT_TO_SETTER = const MessageKind( |
| 521 "Info: This is the setter patch '#{setterName}'."); | 640 'Info: This is the setter patch "#{setterName}".'); |
| 522 | 641 |
| 523 static const PATCH_POINT_TO_CONSTRUCTOR = const MessageKind( | 642 static const MessageKind PATCH_POINT_TO_CONSTRUCTOR = const MessageKind( |
| 524 "Info: This is the constructor patch '#{constructorName}'."); | 643 'Info: This is the constructor patch "#{constructorName}".'); |
| 525 | 644 |
| 526 static const PATCH_POINT_TO_PARAMETER = const MessageKind( | 645 static const MessageKind PATCH_POINT_TO_PARAMETER = const MessageKind( |
| 527 "Info: This is the patch parameter '#{parameterName}'."); | 646 'Info: This is the patch parameter "#{parameterName}".'); |
| 528 | 647 |
| 529 static const PATCH_NON_EXISTING = const MessageKind( | 648 static const MessageKind PATCH_NON_EXISTING = const MessageKind( |
| 530 "Error: Origin does not exist for patch '#{name}'."); | 649 'Error: Origin does not exist for patch "#{name}".'); |
| 531 | 650 |
| 532 static const PATCH_NONPATCHABLE = const MessageKind( | 651 static const MessageKind PATCH_NONPATCHABLE = const MessageKind( |
| 533 "Error: Only classes and functions can be patched."); | 652 'Error: Only classes and functions can be patched.'); |
| 534 | 653 |
| 535 static const PATCH_NON_EXTERNAL = const MessageKind( | 654 static const MessageKind PATCH_NON_EXTERNAL = const MessageKind( |
| 536 "Error: Only external functions can be patched."); | 655 'Error: Only external functions can be patched.'); |
| 537 | 656 |
| 538 static const PATCH_NON_CLASS = const MessageKind( | 657 static const MessageKind PATCH_NON_CLASS = const MessageKind( |
| 539 "Error: Patching non-class with class patch '#{className}'."); | 658 'Error: Patching non-class with class patch "#{className}".'); |
| 540 | 659 |
| 541 static const PATCH_NON_GETTER = const MessageKind( | 660 static const MessageKind PATCH_NON_GETTER = const MessageKind( |
| 542 "Error: Cannot patch non-getter '#{name}' with getter patch."); | 661 'Error: Cannot patch non-getter "#{name}" with getter patch.'); |
| 543 | 662 |
| 544 static const PATCH_NO_GETTER = const MessageKind( | 663 static const MessageKind PATCH_NO_GETTER = const MessageKind( |
| 545 "Error: No getter found for getter patch '#{getterName}'."); | 664 'Error: No getter found for getter patch "#{getterName}".'); |
| 546 | 665 |
| 547 static const PATCH_NON_SETTER = const MessageKind( | 666 static const MessageKind PATCH_NON_SETTER = const MessageKind( |
| 548 "Error: Cannot patch non-setter '#{name}' with setter patch."); | 667 'Error: Cannot patch non-setter "#{name}" with setter patch.'); |
| 549 | 668 |
| 550 static const PATCH_NO_SETTER = const MessageKind( | 669 static const MessageKind PATCH_NO_SETTER = const MessageKind( |
| 551 "Error: No setter found for setter patch '#{setterName}'."); | 670 'Error: No setter found for setter patch "#{setterName}".'); |
| 552 | 671 |
| 553 static const PATCH_NON_CONSTRUCTOR = const MessageKind( | 672 static const MessageKind PATCH_NON_CONSTRUCTOR = const MessageKind( |
| 554 "Error: Cannot patch non-constructor with constructor patch " | 673 'Error: Cannot patch non-constructor with constructor patch ' |
| 555 "'#{constructorName}'."); | 674 '"#{constructorName}".'); |
| 556 | 675 |
| 557 static const PATCH_NON_FUNCTION = const MessageKind( | 676 static const MessageKind PATCH_NON_FUNCTION = const MessageKind( |
| 558 "Error: Cannot patch non-function with function patch " | 677 'Error: Cannot patch non-function with function patch ' |
| 559 "'#{functionName}'."); | 678 '"#{functionName}".'); |
| 560 | 679 |
| 561 ////////////////////////////////////////////////////////////////////////////// | 680 ////////////////////////////////////////////////////////////////////////////// |
| 562 // Patch errors end. | 681 // Patch errors end. |
| 563 ////////////////////////////////////////////////////////////////////////////// | 682 ////////////////////////////////////////////////////////////////////////////// |
| 564 | 683 |
| 565 toString() => template; | 684 toString() => template; |
| 566 | 685 |
| 567 Message message([Map arguments = const {}]) { | 686 Message message([Map arguments = const {}]) { |
| 568 return new Message(this, arguments); | 687 return new Message(this, arguments); |
| 569 } | 688 } |
| 570 | 689 |
| 571 CompilationError error([Map arguments = const {}]) { | 690 CompilationError error([Map arguments = const {}]) { |
| 572 return new CompilationError(this, arguments); | 691 return new CompilationError(this, arguments); |
| 573 } | 692 } |
| 574 } | 693 } |
| 575 | 694 |
| 695 class DualKind { | |
| 696 final MessageKind error; | |
| 697 final MessageKind warning; | |
| 698 | |
| 699 const DualKind({this.error, this.warning}); | |
| 700 } | |
| 701 | |
| 576 class Message { | 702 class Message { |
| 577 final kind; | 703 final kind; |
| 578 final Map arguments; | 704 final Map arguments; |
| 579 String message; | 705 String message; |
| 580 | 706 |
| 581 Message(this.kind, this.arguments) { | 707 Message(this.kind, this.arguments) { |
| 582 assert(() { computeMessage(); return true; }); | 708 assert(() { computeMessage(); return true; }); |
| 583 } | 709 } |
| 584 | 710 |
| 585 String computeMessage() { | 711 String computeMessage() { |
| 586 if (message == null) { | 712 if (message == null) { |
| 587 message = kind.template; | 713 message = kind.template; |
| 588 arguments.forEach((key, value) { | 714 arguments.forEach((key, value) { |
| 589 String string = slowToString(value); | 715 String string = slowToString(value); |
| 590 message = message.replaceAll('#{${key}}', string); | 716 message = message.replaceAll('#{${key}}', string); |
| 591 }); | 717 }); |
| 592 assert(invariant( | 718 assert(invariant( |
| 593 CURRENT_ELEMENT_SPANNABLE, | 719 CURRENT_ELEMENT_SPANNABLE, |
| 594 !message.contains(new RegExp(r"#\{.+\}")), | 720 !message.contains(new RegExp(r'#\{.+\}')), |
| 595 message: 'Missing arguments in error message: "$message"')); | 721 message: 'Missing arguments in error message: "$message"')); |
| 596 } | 722 } |
| 597 return message; | 723 return message; |
| 598 } | 724 } |
| 599 | 725 |
| 600 String toString() { | 726 String toString() { |
| 601 return computeMessage(); | 727 return computeMessage(); |
| 602 } | 728 } |
| 603 | 729 |
| 604 bool operator==(other) { | 730 bool operator==(other) { |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 622 Diagnostic(MessageKind kind, [Map arguments = const {}]) | 748 Diagnostic(MessageKind kind, [Map arguments = const {}]) |
| 623 : message = new Message(kind, arguments); | 749 : message = new Message(kind, arguments); |
| 624 String toString() => message.toString(); | 750 String toString() => message.toString(); |
| 625 } | 751 } |
| 626 | 752 |
| 627 class TypeWarning extends Diagnostic { | 753 class TypeWarning extends Diagnostic { |
| 628 TypeWarning(MessageKind kind, [Map arguments = const {}]) | 754 TypeWarning(MessageKind kind, [Map arguments = const {}]) |
| 629 : super(kind, arguments); | 755 : super(kind, arguments); |
| 630 } | 756 } |
| 631 | 757 |
| 632 class ResolutionError extends Diagnostic { | |
| 633 ResolutionError(MessageKind kind, [Map arguments = const {}]) | |
| 634 : super(kind, arguments); | |
| 635 } | |
| 636 | |
| 637 class ResolutionWarning extends Diagnostic { | 758 class ResolutionWarning extends Diagnostic { |
| 638 ResolutionWarning(MessageKind kind, [Map arguments = const {}]) | 759 ResolutionWarning(MessageKind kind, [Map arguments = const {}]) |
| 639 : super(kind, arguments); | 760 : super(kind, arguments); |
| 640 } | 761 } |
| 641 | 762 |
| 642 class CompileTimeConstantError extends Diagnostic { | 763 class CompileTimeConstantError extends Diagnostic { |
| 643 CompileTimeConstantError(MessageKind kind, [Map arguments = const {}]) | 764 CompileTimeConstantError(MessageKind kind, [Map arguments = const {}]) |
| 644 : super(kind, arguments); | 765 : super(kind, arguments); |
| 645 } | 766 } |
| 646 | 767 |
| 647 class CompilationError extends Diagnostic { | 768 class CompilationError extends Diagnostic { |
| 648 CompilationError(MessageKind kind, [Map arguments = const {}]) | 769 CompilationError(MessageKind kind, [Map arguments = const {}]) |
| 649 : super(kind, arguments); | 770 : super(kind, arguments); |
| 650 } | 771 } |
| OLD | NEW |