OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // The infrastructure used for (localized) message reporting in V8. | 5 // The infrastructure used for (localized) message reporting in V8. |
6 // | 6 // |
7 // Note: there's a big unresolved issue about ownership of the data | 7 // Note: there's a big unresolved issue about ownership of the data |
8 // structures used by this framework. | 8 // structures used by this framework. |
9 | 9 |
10 #ifndef V8_MESSAGES_H_ | 10 #ifndef V8_MESSAGES_H_ |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 T(InvalidArgument, "invalid_argument") \ | 163 T(InvalidArgument, "invalid_argument") \ |
164 T(InvalidInOperatorUse, "Cannot use 'in' operator to search for '%' in %") \ | 164 T(InvalidInOperatorUse, "Cannot use 'in' operator to search for '%' in %") \ |
165 T(IteratorResultNotAnObject, "Iterator result % is not an object") \ | 165 T(IteratorResultNotAnObject, "Iterator result % is not an object") \ |
166 T(IteratorValueNotAnObject, "Iterator value % is not an entry object") \ | 166 T(IteratorValueNotAnObject, "Iterator value % is not an entry object") \ |
167 T(LanguageID, "Language ID should be string or object.") \ | 167 T(LanguageID, "Language ID should be string or object.") \ |
168 T(MethodCalledOnWrongObject, \ | 168 T(MethodCalledOnWrongObject, \ |
169 "Method % called on a non-object or on a wrong type of object.") \ | 169 "Method % called on a non-object or on a wrong type of object.") \ |
170 T(MethodInvokedOnNullOrUndefined, \ | 170 T(MethodInvokedOnNullOrUndefined, \ |
171 "Method invoked on undefined or null value.") \ | 171 "Method invoked on undefined or null value.") \ |
172 T(MethodInvokedOnWrongType, "Method invoked on an object that is not %.") \ | 172 T(MethodInvokedOnWrongType, "Method invoked on an object that is not %.") \ |
| 173 T(NoAccess, "no access") \ |
173 T(NonExtensibleProto, "% is not extensible") \ | 174 T(NonExtensibleProto, "% is not extensible") \ |
174 T(NonObjectPropertyLoad, "Cannot read property '%' of %") \ | 175 T(NonObjectPropertyLoad, "Cannot read property '%' of %") \ |
175 T(NonObjectPropertyStore, "Cannot set property '%' of %") \ | 176 T(NonObjectPropertyStore, "Cannot set property '%' of %") \ |
176 T(NoSetterInCallback, "Cannot set property % of % which has only a getter") \ | 177 T(NoSetterInCallback, "Cannot set property % of % which has only a getter") \ |
177 T(NotAnIterator, "% is not an iterator") \ | 178 T(NotAnIterator, "% is not an iterator") \ |
178 T(NotAPromise, "% is not a promise") \ | 179 T(NotAPromise, "% is not a promise") \ |
179 T(NotConstructor, "% is not a constructor") \ | 180 T(NotConstructor, "% is not a constructor") \ |
180 T(NotDateObject, "this is not a Date object.") \ | 181 T(NotDateObject, "this is not a Date object.") \ |
181 T(NotIntlObject, "% is not an i18n object.") \ | 182 T(NotIntlObject, "% is not an i18n object.") \ |
182 T(NotGeneric, "% is not generic") \ | 183 T(NotGeneric, "% is not generic") \ |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 T(ProxyPropNotConfigurable, \ | 222 T(ProxyPropNotConfigurable, \ |
222 "Proxy handler % returned non-configurable descriptor for property '%' " \ | 223 "Proxy handler % returned non-configurable descriptor for property '%' " \ |
223 "from '%' trap") \ | 224 "from '%' trap") \ |
224 T(ProxyRepeatedPropName, "Trap '%' returned repeated property name '%'") \ | 225 T(ProxyRepeatedPropName, "Trap '%' returned repeated property name '%'") \ |
225 T(ProxyTrapFunctionExpected, \ | 226 T(ProxyTrapFunctionExpected, \ |
226 "Proxy.createFunction called with non-function for '%' trap") \ | 227 "Proxy.createFunction called with non-function for '%' trap") \ |
227 T(RedefineDisallowed, "Cannot redefine property: %") \ | 228 T(RedefineDisallowed, "Cannot redefine property: %") \ |
228 T(RedefineExternalArray, \ | 229 T(RedefineExternalArray, \ |
229 "Cannot redefine a property of an object with external array elements") \ | 230 "Cannot redefine a property of an object with external array elements") \ |
230 T(ReduceNoInitial, "Reduce of empty array with no initial value") \ | 231 T(ReduceNoInitial, "Reduce of empty array with no initial value") \ |
| 232 T(RegExpFlags, \ |
| 233 "Cannot supply flags when constructing one RegExp from another") \ |
231 T(ReinitializeIntl, "Trying to re-initialize % object.") \ | 234 T(ReinitializeIntl, "Trying to re-initialize % object.") \ |
232 T(ResolvedOptionsCalledOnNonObject, \ | 235 T(ResolvedOptionsCalledOnNonObject, \ |
233 "resolvedOptions method called on a non-object or on a object that is " \ | 236 "resolvedOptions method called on a non-object or on a object that is " \ |
234 "not Intl.%.") \ | 237 "not Intl.%.") \ |
235 T(ResolverNotAFunction, "Promise resolver % is not a function") \ | 238 T(ResolverNotAFunction, "Promise resolver % is not a function") \ |
236 T(RestrictedFunctionProperties, \ | 239 T(RestrictedFunctionProperties, \ |
237 "'caller' and 'arguments' are restricted function properties and cannot " \ | 240 "'caller' and 'arguments' are restricted function properties and cannot " \ |
238 "be accessed in this context.") \ | 241 "be accessed in this context.") \ |
239 T(StaticPrototype, "Classes may not have static property named prototype") \ | 242 T(StaticPrototype, "Classes may not have static property named prototype") \ |
240 T(StrictCannotAssign, "Cannot assign to read only '% in strict mode") \ | 243 T(StrictCannotAssign, "Cannot assign to read only '% in strict mode") \ |
241 T(StrictDeleteProperty, "Cannot delete property '%' of %") \ | 244 T(StrictDeleteProperty, "Cannot delete property '%' of %") \ |
242 T(StrictPoisonPill, \ | 245 T(StrictPoisonPill, \ |
243 "'caller', 'callee', and 'arguments' properties may not be accessed on " \ | 246 "'caller', 'callee', and 'arguments' properties may not be accessed on " \ |
244 "strict mode functions or the arguments objects for calls to them") \ | 247 "strict mode functions or the arguments objects for calls to them") \ |
245 T(StrictReadOnlyProperty, "Cannot assign to read only property '%' of %") \ | 248 T(StrictReadOnlyProperty, "Cannot assign to read only property '%' of %") \ |
246 T(StrongArity, \ | 249 T(StrongArity, \ |
247 "In strong mode, calling a function with too few arguments is deprecated") \ | 250 "In strong mode, calling a function with too few arguments is deprecated") \ |
248 T(StrongImplicitCast, "In strong mode, implicit conversions are deprecated") \ | 251 T(StrongImplicitCast, "In strong mode, implicit conversions are deprecated") \ |
| 252 T(SymbolKeyFor, "% is not a symbol") \ |
249 T(SymbolToPrimitive, \ | 253 T(SymbolToPrimitive, \ |
250 "Cannot convert a Symbol wrapper object to a primitive value") \ | 254 "Cannot convert a Symbol wrapper object to a primitive value") \ |
251 T(SymbolToNumber, "Cannot convert a Symbol value to a number") \ | 255 T(SymbolToNumber, "Cannot convert a Symbol value to a number") \ |
252 T(SymbolToString, "Cannot convert a Symbol value to a string") \ | 256 T(SymbolToString, "Cannot convert a Symbol value to a string") \ |
253 T(UndefinedOrNullToObject, "Cannot convert undefined or null to object") \ | 257 T(UndefinedOrNullToObject, "Cannot convert undefined or null to object") \ |
254 T(ValueAndAccessor, \ | 258 T(ValueAndAccessor, \ |
255 "Invalid property. A property cannot both have accessors and be " \ | 259 "Invalid property. A property cannot both have accessors and be " \ |
256 "writable or have a value, %") \ | 260 "writable or have a value, %") \ |
257 T(VarRedeclaration, "Identifier '%' has already been declared") \ | 261 T(VarRedeclaration, "Identifier '%' has already been declared") \ |
258 T(WithExpression, "% has no properties") \ | 262 T(WithExpression, "% has no properties") \ |
259 T(WrongArgs, "%: Arguments list has wrong type") \ | 263 T(WrongArgs, "%: Arguments list has wrong type") \ |
260 /* ReferenceError */ \ | 264 /* ReferenceError */ \ |
261 T(NonMethod, "'super' is referenced from non-method") \ | 265 T(NonMethod, "'super' is referenced from non-method") \ |
262 T(NotDefined, "% is not defined") \ | 266 T(NotDefined, "% is not defined") \ |
263 T(UnsupportedSuper, "Unsupported reference to 'super'") \ | 267 T(UnsupportedSuper, "Unsupported reference to 'super'") \ |
264 /* RangeError */ \ | 268 /* RangeError */ \ |
265 T(ArrayLengthOutOfRange, "defineProperty() array length out of range") \ | 269 T(ArrayLengthOutOfRange, "defineProperty() array length out of range") \ |
266 T(DateRange, "Provided date is not in valid range.") \ | 270 T(DateRange, "Provided date is not in valid range.") \ |
267 T(ExpectedLocation, "Expected Area/Location for time zone, got %") \ | 271 T(ExpectedLocation, "Expected Area/Location for time zone, got %") \ |
268 T(InvalidArrayBufferLength, "Invalid array buffer length") \ | 272 T(InvalidArrayBufferLength, "Invalid array buffer length") \ |
269 T(InvalidArrayLength, "Invalid array length") \ | 273 T(InvalidArrayLength, "Invalid array length") \ |
270 T(InvalidCodePoint, "Invalid code point %") \ | 274 T(InvalidCodePoint, "Invalid code point %") \ |
271 T(InvalidCountValue, "Invalid count value") \ | 275 T(InvalidCountValue, "Invalid count value") \ |
272 T(InvalidCurrencyCode, "Invalid currency code: %") \ | 276 T(InvalidCurrencyCode, "Invalid currency code: %") \ |
273 T(InvalidDataViewAccessorOffset, \ | 277 T(InvalidDataViewAccessorOffset, \ |
274 "Offset is outside the bounds of the DataView") \ | 278 "Offset is outside the bounds of the DataView") \ |
275 T(InvalidDataViewLength, "Invalid data view length") \ | 279 T(InvalidDataViewLength, "Invalid data view length") \ |
276 T(InvalidDataViewOffset, "Start offset is outside the bounds of the buffer") \ | 280 T(InvalidDataViewOffset, "Start offset is outside the bounds of the buffer") \ |
277 T(InvalidLanguageTag, "Invalid language tag: %") \ | 281 T(InvalidLanguageTag, "Invalid language tag: %") \ |
| 282 T(InvalidWeakMapKey, "Invalid value used as weak map key") \ |
| 283 T(InvalidWeakSetValue, "Invalid value used in weak set") \ |
278 T(InvalidStringLength, "Invalid string length") \ | 284 T(InvalidStringLength, "Invalid string length") \ |
279 T(InvalidTimeValue, "Invalid time value") \ | 285 T(InvalidTimeValue, "Invalid time value") \ |
280 T(InvalidTypedArrayAlignment, "% of % should be a multiple of %") \ | 286 T(InvalidTypedArrayAlignment, "% of % should be a multiple of %") \ |
281 T(InvalidTypedArrayLength, "Invalid typed array length") \ | 287 T(InvalidTypedArrayLength, "Invalid typed array length") \ |
282 T(InvalidTypedArrayOffset, "Start offset is too large:") \ | 288 T(InvalidTypedArrayOffset, "Start offset is too large:") \ |
283 T(LocaleMatcher, "Illegal value for localeMatcher:%") \ | 289 T(LocaleMatcher, "Illegal value for localeMatcher:%") \ |
284 T(NormalizationForm, "The normalization form should be one of %.") \ | 290 T(NormalizationForm, "The normalization form should be one of %.") \ |
285 T(NumberFormatRange, "% argument must be between 0 and 20") \ | 291 T(NumberFormatRange, "% argument must be between 0 and 20") \ |
286 T(PropertyValueOutOfRange, "% value is out of range.") \ | 292 T(PropertyValueOutOfRange, "% value is out of range.") \ |
287 T(StackOverflow, "Maximum call stack size exceeded") \ | 293 T(StackOverflow, "Maximum call stack size exceeded") \ |
288 T(ToPrecisionFormatRange, "toPrecision() argument must be between 1 and 21") \ | 294 T(ToPrecisionFormatRange, "toPrecision() argument must be between 1 and 21") \ |
289 T(ToRadixFormatRange, "toString() radix argument must be between 2 and 36") \ | 295 T(ToRadixFormatRange, "toString() radix argument must be between 2 and 36") \ |
290 T(TypedArraySetNegativeOffset, "Start offset is negative") \ | 296 T(TypedArraySetNegativeOffset, "Start offset is negative") \ |
291 T(TypedArraySetSourceTooLarge, "Source is too large") \ | 297 T(TypedArraySetSourceTooLarge, "Source is too large") \ |
292 T(UnsupportedTimeZone, "Unsupported time zone specified %") \ | 298 T(UnsupportedTimeZone, "Unsupported time zone specified %") \ |
293 T(ValueOutOfRange, "Value % out of range for % options property %") \ | 299 T(ValueOutOfRange, "Value % out of range for % options property %") \ |
294 /* SyntaxError */ \ | 300 /* SyntaxError */ \ |
| 301 T(InvalidRegExpFlags, "Invalid flags supplied to RegExp constructor '%'") \ |
| 302 T(MalformedRegExp, "Invalid regular expression: /%/: %") \ |
295 T(ParenthesisInArgString, "Function arg string contains parenthesis") \ | 303 T(ParenthesisInArgString, "Function arg string contains parenthesis") \ |
| 304 T(UnexpectedEOS, "Unexpected end of input") \ |
| 305 T(UnexpectedToken, "Unexpected token %") \ |
| 306 T(UnexpectedTokenNumber, "Unexpected number") \ |
| 307 T(UnexpectedTokenString, "Unexpected string") \ |
296 /* EvalError */ \ | 308 /* EvalError */ \ |
297 T(CodeGenFromStrings, "%") \ | 309 T(CodeGenFromStrings, "%") \ |
298 /* URIError */ \ | 310 /* URIError */ \ |
299 T(URIMalformed, "URI malformed") | 311 T(URIMalformed, "URI malformed") |
300 | 312 |
301 class MessageTemplate { | 313 class MessageTemplate { |
302 public: | 314 public: |
303 enum Template { | 315 enum Template { |
304 #define TEMPLATE(NAME, STRING) k##NAME, | 316 #define TEMPLATE(NAME, STRING) k##NAME, |
305 MESSAGE_TEMPLATES(TEMPLATE) | 317 MESSAGE_TEMPLATES(TEMPLATE) |
306 #undef TEMPLATE | 318 #undef TEMPLATE |
307 kLastMessage | 319 kLastMessage |
308 }; | 320 }; |
309 | 321 |
310 static MaybeHandle<String> FormatMessage(int template_index, | 322 static MaybeHandle<String> FormatMessage(int template_index, |
311 Handle<String> arg0, | 323 Handle<String> arg0, |
312 Handle<String> arg1, | 324 Handle<String> arg1, |
313 Handle<String> arg2); | 325 Handle<String> arg2); |
314 }; | 326 }; |
315 } } // namespace v8::internal | 327 } } // namespace v8::internal |
316 | 328 |
317 #endif // V8_MESSAGES_H_ | 329 #endif // V8_MESSAGES_H_ |
OLD | NEW |