Line data Source code
1 : // Copyright 2018 the V8 project authors. All rights reserved.
2 : // Use of this source code is governed by a BSD-style license that can be
3 : // found in the LICENSE file.
4 :
5 : #ifndef V8_MESSAGE_TEMPLATE_H_
6 : #define V8_MESSAGE_TEMPLATE_H_
7 :
8 : #include "src/base/logging.h"
9 :
10 : namespace v8 {
11 : namespace internal {
12 :
13 : // TODO(913887): fix the use of 'neuter' in these error messages.
14 : #define MESSAGE_TEMPLATES(T) \
15 : /* Error */ \
16 : T(None, "") \
17 : T(CyclicProto, "Cyclic __proto__ value") \
18 : T(Debugger, "Debugger: %") \
19 : T(DebuggerLoading, "Error loading debugger") \
20 : T(DefaultOptionsMissing, "Internal % error. Default options are missing.") \
21 : T(DeletePrivateField, "Private fields can not be deleted") \
22 : T(UncaughtException, "Uncaught %") \
23 : T(Unsupported, "Not supported") \
24 : T(WrongServiceType, "Internal error, wrong service type: %") \
25 : T(WrongValueType, "Internal error. Wrong value type.") \
26 : T(IcuError, "Internal error. Icu error.") \
27 : /* TypeError */ \
28 : T(ApplyNonFunction, \
29 : "Function.prototype.apply was called on %, which is a % and not a " \
30 : "function") \
31 : T(ArgumentsDisallowedInInitializer, \
32 : "'arguments' is not allowed in class field initializer") \
33 : T(ArrayBufferTooShort, \
34 : "Derived ArrayBuffer constructor created a buffer which was too small") \
35 : T(ArrayBufferSpeciesThis, \
36 : "ArrayBuffer subclass returned this from species constructor") \
37 : T(ArrayItemNotType, "array %[%] is not type %") \
38 : T(AwaitNotInAsyncFunction, "await is only valid in async function") \
39 : T(AtomicsWaitNotAllowed, "Atomics.wait cannot be called in this context") \
40 : T(BadSortComparisonFunction, \
41 : "The comparison function must be either a function or undefined") \
42 : T(BigIntFromNumber, \
43 : "The number % cannot be converted to a BigInt because it is not an " \
44 : "integer") \
45 : T(BigIntFromObject, "Cannot convert % to a BigInt") \
46 : T(BigIntMixedTypes, \
47 : "Cannot mix BigInt and other types, use explicit conversions") \
48 : T(BigIntSerializeJSON, "Do not know how to serialize a BigInt") \
49 : T(BigIntShr, "BigInts have no unsigned right shift, use >> instead") \
50 : T(BigIntToNumber, "Cannot convert a BigInt value to a number") \
51 : T(CalledNonCallable, "% is not a function") \
52 : T(CalledOnNonObject, "% called on non-object") \
53 : T(CalledOnNullOrUndefined, "% called on null or undefined") \
54 : T(CallSiteExpectsFunction, \
55 : "CallSite expects wasm object as first or function as second argument, " \
56 : "got <%, %>") \
57 : T(CallSiteMethod, "CallSite method % expects CallSite as receiver") \
58 : T(CannotConvertToPrimitive, "Cannot convert object to primitive value") \
59 : T(CannotPreventExt, "Cannot prevent extensions") \
60 : T(CannotFreeze, "Cannot freeze") \
61 : T(CannotFreezeArrayBufferView, \
62 : "Cannot freeze array buffer views with elements") \
63 : T(CannotSeal, "Cannot seal") \
64 : T(CircularStructure, "Converting circular structure to JSON") \
65 : T(ConstructAbstractClass, "Abstract class % not directly constructable") \
66 : T(ConstAssign, "Assignment to constant variable.") \
67 : T(ConstructorClassField, "Classes may not have a field named 'constructor'") \
68 : T(ConstructorNonCallable, \
69 : "Class constructor % cannot be invoked without 'new'") \
70 : T(ConstructorNotFunction, "Constructor % requires 'new'") \
71 : T(ConstructorNotReceiver, "The .constructor property is not an object") \
72 : T(CurrencyCode, "Currency code is required with currency style.") \
73 : T(CyclicModuleDependency, "Detected cycle while resolving name '%' in '%'") \
74 : T(DataViewNotArrayBuffer, \
75 : "First argument to DataView constructor must be an ArrayBuffer") \
76 : T(DateType, "this is not a Date object.") \
77 : T(DebuggerFrame, "Debugger: Invalid frame index.") \
78 : T(DebuggerType, "Debugger: Parameters have wrong types.") \
79 : T(DeclarationMissingInitializer, "Missing initializer in % declaration") \
80 : T(DefineDisallowed, "Cannot define property %, object is not extensible") \
81 : T(DetachedOperation, "Cannot perform % on a neutered ArrayBuffer") \
82 : T(DuplicateTemplateProperty, "Object template has duplicate property '%'") \
83 : T(ExtendsValueNotConstructor, \
84 : "Class extends value % is not a constructor or null") \
85 : T(FirstArgumentNotRegExp, \
86 : "First argument to % must not be a regular expression") \
87 : T(FunctionBind, "Bind must be called on a function") \
88 : T(GeneratorRunning, "Generator is already running") \
89 : T(IllegalInvocation, "Illegal invocation") \
90 : T(ImmutablePrototypeSet, \
91 : "Immutable prototype object '%' cannot have their prototype set") \
92 : T(ImportCallNotNewExpression, "Cannot use new with import") \
93 : T(ImportMetaOutsideModule, "Cannot use 'import.meta' outside a module") \
94 : T(ImportMissingSpecifier, "import() requires a specifier") \
95 : T(IncompatibleMethodReceiver, "Method % called on incompatible receiver %") \
96 : T(InstanceofNonobjectProto, \
97 : "Function has non-object prototype '%' in instanceof check") \
98 : T(InvalidArgument, "invalid_argument") \
99 : T(InvalidInOperatorUse, "Cannot use 'in' operator to search for '%' in %") \
100 : T(InvalidRegExpExecResult, \
101 : "RegExp exec method returned something other than an Object or null") \
102 : T(InvalidUnit, "Invalid unit argument for %() '%'") \
103 : T(IteratorResultNotAnObject, "Iterator result % is not an object") \
104 : T(IteratorSymbolNonCallable, "Found non-callable @@iterator") \
105 : T(IteratorValueNotAnObject, "Iterator value % is not an entry object") \
106 : T(LanguageID, "Language ID should be string or object.") \
107 : T(LocaleNotEmpty, \
108 : "First argument to Intl.Locale constructor can't be empty or missing") \
109 : T(LocaleBadParameters, "Incorrect locale information provided") \
110 : T(ListFormatBadParameters, "Incorrect ListFormat information provided") \
111 : T(MapperFunctionNonCallable, "flatMap mapper function is not callable") \
112 : T(MethodCalledOnWrongObject, \
113 : "Method % called on a non-object or on a wrong type of object.") \
114 : T(MethodInvokedOnNullOrUndefined, \
115 : "Method invoked on undefined or null value.") \
116 : T(MethodInvokedOnWrongType, "Method invoked on an object that is not %.") \
117 : T(NoAccess, "no access") \
118 : T(NonCallableInInstanceOfCheck, \
119 : "Right-hand side of 'instanceof' is not callable") \
120 : T(NonCoercible, "Cannot destructure 'undefined' or 'null'.") \
121 : T(NonCoercibleWithProperty, \
122 : "Cannot destructure property `%` of 'undefined' or 'null'.") \
123 : T(NonExtensibleProto, "% is not extensible") \
124 : T(NonObjectInInstanceOfCheck, \
125 : "Right-hand side of 'instanceof' is not an object") \
126 : T(NonObjectPropertyLoad, "Cannot read property '%' of %") \
127 : T(NonObjectPropertyStore, "Cannot set property '%' of %") \
128 : T(NoSetterInCallback, "Cannot set property % of % which has only a getter") \
129 : T(NotAnIterator, "% is not an iterator") \
130 : T(NotAPromise, "% is not a promise") \
131 : T(NotConstructor, "% is not a constructor") \
132 : T(NotDateObject, "this is not a Date object.") \
133 : T(NotGeneric, "% requires that 'this' be a %") \
134 : T(NotCallableOrIterable, \
135 : "% is not a function or its return value is not iterable") \
136 : T(NotCallableOrAsyncIterable, \
137 : "% is not a function or its return value is not async iterable") \
138 : T(NotFiniteNumber, "Value need to be finite number for %()") \
139 : T(NotIterable, "% is not iterable") \
140 : T(NotIterableNoSymbolLoad, "% is not iterable (cannot read property %)") \
141 : T(NotAsyncIterable, "% is not async iterable") \
142 : T(NotPropertyName, "% is not a valid property name") \
143 : T(NotTypedArray, "this is not a typed array.") \
144 : T(NotSuperConstructor, "Super constructor % of % is not a constructor") \
145 : T(NotSuperConstructorAnonymousClass, \
146 : "Super constructor % of anonymous class is not a constructor") \
147 : T(NotIntegerSharedTypedArray, "% is not an integer shared typed array.") \
148 : T(NotInt32SharedTypedArray, "% is not an int32 shared typed array.") \
149 : T(ObjectGetterExpectingFunction, \
150 : "Object.prototype.__defineGetter__: Expecting function") \
151 : T(ObjectGetterCallable, "Getter must be a function: %") \
152 : T(ObjectNotExtensible, "Cannot add property %, object is not extensible") \
153 : T(ObjectSetterExpectingFunction, \
154 : "Object.prototype.__defineSetter__: Expecting function") \
155 : T(ObjectSetterCallable, "Setter must be a function: %") \
156 : T(OrdinaryFunctionCalledAsConstructor, \
157 : "Function object that's not a constructor was created with new") \
158 : T(PromiseCyclic, "Chaining cycle detected for promise %") \
159 : T(PromiseExecutorAlreadyInvoked, \
160 : "Promise executor has already been invoked with non-undefined arguments") \
161 : T(PromiseNonCallable, "Promise resolve or reject function is not callable") \
162 : T(PropertyDescObject, "Property description must be an object: %") \
163 : T(PropertyNotFunction, \
164 : "'%' returned for property '%' of object '%' is not a function") \
165 : T(ProtoObjectOrNull, "Object prototype may only be an Object or null: %") \
166 : T(PrototypeParentNotAnObject, \
167 : "Class extends value does not have valid prototype property %") \
168 : T(ProxyConstructNonObject, \
169 : "'construct' on proxy: trap returned non-object ('%')") \
170 : T(ProxyDefinePropertyNonConfigurable, \
171 : "'defineProperty' on proxy: trap returned truish for defining " \
172 : "non-configurable property '%' which is either non-existent or " \
173 : "configurable in the proxy target") \
174 : T(ProxyDefinePropertyNonExtensible, \
175 : "'defineProperty' on proxy: trap returned truish for adding property '%' " \
176 : " to the non-extensible proxy target") \
177 : T(ProxyDefinePropertyIncompatible, \
178 : "'defineProperty' on proxy: trap returned truish for adding property '%' " \
179 : " that is incompatible with the existing property in the proxy target") \
180 : T(ProxyDeletePropertyNonConfigurable, \
181 : "'deleteProperty' on proxy: trap returned truish for property '%' which " \
182 : "is non-configurable in the proxy target") \
183 : T(ProxyGetNonConfigurableData, \
184 : "'get' on proxy: property '%' is a read-only and " \
185 : "non-configurable data property on the proxy target but the proxy " \
186 : "did not return its actual value (expected '%' but got '%')") \
187 : T(ProxyGetNonConfigurableAccessor, \
188 : "'get' on proxy: property '%' is a non-configurable accessor " \
189 : "property on the proxy target and does not have a getter function, but " \
190 : "the trap did not return 'undefined' (got '%')") \
191 : T(ProxyGetOwnPropertyDescriptorIncompatible, \
192 : "'getOwnPropertyDescriptor' on proxy: trap returned descriptor for " \
193 : "property '%' that is incompatible with the existing property in the " \
194 : "proxy target") \
195 : T(ProxyGetOwnPropertyDescriptorInvalid, \
196 : "'getOwnPropertyDescriptor' on proxy: trap returned neither object nor " \
197 : "undefined for property '%'") \
198 : T(ProxyGetOwnPropertyDescriptorNonConfigurable, \
199 : "'getOwnPropertyDescriptor' on proxy: trap reported non-configurability " \
200 : "for property '%' which is either non-existent or configurable in the " \
201 : "proxy target") \
202 : T(ProxyGetOwnPropertyDescriptorNonExtensible, \
203 : "'getOwnPropertyDescriptor' on proxy: trap returned undefined for " \
204 : "property '%' which exists in the non-extensible proxy target") \
205 : T(ProxyGetOwnPropertyDescriptorUndefined, \
206 : "'getOwnPropertyDescriptor' on proxy: trap returned undefined for " \
207 : "property '%' which is non-configurable in the proxy target") \
208 : T(ProxyGetPrototypeOfInvalid, \
209 : "'getPrototypeOf' on proxy: trap returned neither object nor null") \
210 : T(ProxyGetPrototypeOfNonExtensible, \
211 : "'getPrototypeOf' on proxy: proxy target is non-extensible but the " \
212 : "trap did not return its actual prototype") \
213 : T(ProxyHandlerOrTargetRevoked, \
214 : "Cannot create proxy with a revoked proxy as target or handler") \
215 : T(ProxyHasNonConfigurable, \
216 : "'has' on proxy: trap returned falsish for property '%' which exists in " \
217 : "the proxy target as non-configurable") \
218 : T(ProxyHasNonExtensible, \
219 : "'has' on proxy: trap returned falsish for property '%' but the proxy " \
220 : "target is not extensible") \
221 : T(ProxyIsExtensibleInconsistent, \
222 : "'isExtensible' on proxy: trap result does not reflect extensibility of " \
223 : "proxy target (which is '%')") \
224 : T(ProxyNonObject, \
225 : "Cannot create proxy with a non-object as target or handler") \
226 : T(ProxyOwnKeysMissing, \
227 : "'ownKeys' on proxy: trap result did not include '%'") \
228 : T(ProxyOwnKeysNonExtensible, \
229 : "'ownKeys' on proxy: trap returned extra keys but proxy target is " \
230 : "non-extensible") \
231 : T(ProxyPreventExtensionsExtensible, \
232 : "'preventExtensions' on proxy: trap returned truish but the proxy target " \
233 : "is extensible") \
234 : T(ProxyPrivate, "Cannot pass private property name to proxy trap") \
235 : T(ProxyRevoked, "Cannot perform '%' on a proxy that has been revoked") \
236 : T(ProxySetFrozenData, \
237 : "'set' on proxy: trap returned truish for property '%' which exists in " \
238 : "the proxy target as a non-configurable and non-writable data property " \
239 : "with a different value") \
240 : T(ProxySetFrozenAccessor, \
241 : "'set' on proxy: trap returned truish for property '%' which exists in " \
242 : "the proxy target as a non-configurable and non-writable accessor " \
243 : "property without a setter") \
244 : T(ProxySetPrototypeOfNonExtensible, \
245 : "'setPrototypeOf' on proxy: trap returned truish for setting a new " \
246 : "prototype on the non-extensible proxy target") \
247 : T(ProxyTrapReturnedFalsish, "'%' on proxy: trap returned falsish") \
248 : T(ProxyTrapReturnedFalsishFor, \
249 : "'%' on proxy: trap returned falsish for property '%'") \
250 : T(RedefineDisallowed, "Cannot redefine property: %") \
251 : T(RedefineExternalArray, \
252 : "Cannot redefine a property of an object with external array elements") \
253 : T(ReduceNoInitial, "Reduce of empty array with no initial value") \
254 : T(RegExpFlags, \
255 : "Cannot supply flags when constructing one RegExp from another") \
256 : T(RegExpNonObject, "% getter called on non-object %") \
257 : T(RegExpNonRegExp, "% getter called on non-RegExp object") \
258 : T(RelativeDateTimeFormatterBadParameters, \
259 : "Incorrect RelativeDateTimeFormatter provided") \
260 : T(ResolverNotAFunction, "Promise resolver % is not a function") \
261 : T(ReturnMethodNotCallable, "The iterator's 'return' method is not callable") \
262 : T(SharedArrayBufferTooShort, \
263 : "Derived SharedArrayBuffer constructor created a buffer which was too " \
264 : "small") \
265 : T(SharedArrayBufferSpeciesThis, \
266 : "SharedArrayBuffer subclass returned this from species constructor") \
267 : T(StaticPrototype, \
268 : "Classes may not have a static property named 'prototype'") \
269 : T(StrictDeleteProperty, "Cannot delete property '%' of %") \
270 : T(StrictPoisonPill, \
271 : "'caller', 'callee', and 'arguments' properties may not be accessed on " \
272 : "strict mode functions or the arguments objects for calls to them") \
273 : T(StrictReadOnlyProperty, \
274 : "Cannot assign to read only property '%' of % '%'") \
275 : T(StrictCannotCreateProperty, "Cannot create property '%' on % '%'") \
276 : T(SymbolIteratorInvalid, \
277 : "Result of the Symbol.iterator method is not an object") \
278 : T(SymbolAsyncIteratorInvalid, \
279 : "Result of the Symbol.asyncIterator method is not an object") \
280 : T(SymbolKeyFor, "% is not a symbol") \
281 : T(SymbolToNumber, "Cannot convert a Symbol value to a number") \
282 : T(SymbolToString, "Cannot convert a Symbol value to a string") \
283 : T(ThrowMethodMissing, "The iterator does not provide a 'throw' method.") \
284 : T(UndefinedOrNullToObject, "Cannot convert undefined or null to object") \
285 : T(ValueAndAccessor, \
286 : "Invalid property descriptor. Cannot both specify accessors and a value " \
287 : "or writable attribute, %") \
288 : T(VarRedeclaration, "Identifier '%' has already been declared") \
289 : T(WrongArgs, "%: Arguments list has wrong type") \
290 : /* ReferenceError */ \
291 : T(NotDefined, "% is not defined") \
292 : T(SuperAlreadyCalled, "Super constructor may only be called once") \
293 : T(UnsupportedSuper, "Unsupported reference to 'super'") \
294 : /* RangeError */ \
295 : T(BigIntDivZero, "Division by zero") \
296 : T(BigIntNegativeExponent, "Exponent must be positive") \
297 : T(BigIntTooBig, "Maximum BigInt size exceeded") \
298 : T(DateRange, "Provided date is not in valid range.") \
299 : T(ExpectedLocation, \
300 : "Expected letters optionally connected with underscores or hyphens for " \
301 : "a location, got %") \
302 : T(InvalidArrayBufferLength, "Invalid array buffer length") \
303 : T(ArrayBufferAllocationFailed, "Array buffer allocation failed") \
304 : T(InvalidArrayLength, "Invalid array length") \
305 : T(InvalidAtomicAccessIndex, "Invalid atomic access index") \
306 : T(InvalidCodePoint, "Invalid code point %") \
307 : T(InvalidCountValue, "Invalid count value") \
308 : T(InvalidCurrencyCode, "Invalid currency code: %") \
309 : T(InvalidDataViewAccessorOffset, \
310 : "Offset is outside the bounds of the DataView") \
311 : T(InvalidDataViewLength, "Invalid DataView length %") \
312 : T(InvalidOffset, "Start offset % is outside the bounds of the buffer") \
313 : T(InvalidHint, "Invalid hint: %") \
314 : T(InvalidIndex, "Invalid value: not (convertible to) a safe integer") \
315 : T(InvalidLanguageTag, "Invalid language tag: %") \
316 : T(InvalidWeakMapKey, "Invalid value used as weak map key") \
317 : T(InvalidWeakSetValue, "Invalid value used in weak set") \
318 : T(InvalidStringLength, "Invalid string length") \
319 : T(InvalidTimeValue, "Invalid time value") \
320 : T(InvalidTimeZone, "Invalid time zone specified: %") \
321 : T(InvalidTypedArrayAlignment, "% of % should be a multiple of %") \
322 : T(InvalidTypedArrayIndex, "Invalid typed array index") \
323 : T(InvalidTypedArrayLength, "Invalid typed array length: %") \
324 : T(IllegalTypeWhileStyleNarrow, \
325 : "When style is 'narrow', 'unit' is the only allowed value for the type " \
326 : "option.") \
327 : T(LetInLexicalBinding, "let is disallowed as a lexically bound name") \
328 : T(LocaleMatcher, "Illegal value for localeMatcher:%") \
329 : T(NormalizationForm, "The normalization form should be one of %.") \
330 : T(ParameterOfFunctionOutOfRange, \
331 : "Paramenter % of function %() is % and out of range") \
332 : T(ZeroDigitNumericSeparator, \
333 : "Numeric separator can not be used after leading 0.") \
334 : T(NumberFormatRange, "% argument must be between 0 and 100") \
335 : T(TrailingNumericSeparator, \
336 : "Numeric separators are not allowed at the end of numeric literals") \
337 : T(ContinuousNumericSeparator, \
338 : "Only one underscore is allowed as numeric separator") \
339 : T(PropertyValueOutOfRange, "% value is out of range.") \
340 : T(StackOverflow, "Maximum call stack size exceeded") \
341 : T(ToPrecisionFormatRange, \
342 : "toPrecision() argument must be between 1 and 100") \
343 : T(ToRadixFormatRange, "toString() radix argument must be between 2 and 36") \
344 : T(TypedArraySetOffsetOutOfBounds, "offset is out of bounds") \
345 : T(TypedArraySetSourceTooLarge, "Source is too large") \
346 : T(ValueOutOfRange, "Value % out of range for % options property %") \
347 : /* SyntaxError */ \
348 : T(AmbiguousExport, \
349 : "The requested module '%' contains conflicting star exports for name '%'") \
350 : T(BadGetterArity, "Getter must not have any formal parameters.") \
351 : T(BadSetterArity, "Setter must have exactly one formal parameter.") \
352 : T(BigIntInvalidString, "Invalid BigInt string") \
353 : T(ConstructorIsAccessor, "Class constructor may not be an accessor") \
354 : T(ConstructorIsGenerator, "Class constructor may not be a generator") \
355 : T(ConstructorIsAsync, "Class constructor may not be an async method") \
356 : T(ConstructorIsPrivate, "Class constructor may not be a private method") \
357 : T(DerivedConstructorReturnedNonObject, \
358 : "Derived constructors may only return object or undefined") \
359 : T(DuplicateConstructor, "A class may only have one constructor") \
360 : T(DuplicateExport, "Duplicate export of '%'") \
361 : T(DuplicateProto, \
362 : "Duplicate __proto__ fields are not allowed in object literals") \
363 : T(ForInOfLoopInitializer, \
364 : "% loop variable declaration may not have an initializer.") \
365 : T(ForInOfLoopMultiBindings, \
366 : "Invalid left-hand side in % loop: Must have a single binding.") \
367 : T(GeneratorInSingleStatementContext, \
368 : "Generators can only be declared at the top level or inside a block.") \
369 : T(AsyncFunctionInSingleStatementContext, \
370 : "Async functions can only be declared at the top level or inside a " \
371 : "block.") \
372 : T(IllegalBreak, "Illegal break statement") \
373 : T(NoIterationStatement, \
374 : "Illegal continue statement: no surrounding iteration statement") \
375 : T(IllegalContinue, \
376 : "Illegal continue statement: '%' does not denote an iteration statement") \
377 : T(IllegalLanguageModeDirective, \
378 : "Illegal '%' directive in function with non-simple parameter list") \
379 : T(IllegalReturn, "Illegal return statement") \
380 : T(IntrinsicWithSpread, "Intrinsic calls do not support spread arguments") \
381 : T(InvalidRestBindingPattern, \
382 : "`...` must be followed by an identifier in declaration contexts") \
383 : T(InvalidPropertyBindingPattern, "Illegal property in declaration context") \
384 : T(InvalidRestAssignmentPattern, \
385 : "`...` must be followed by an assignable reference in assignment " \
386 : "contexts") \
387 : T(InvalidEscapedReservedWord, "Keyword must not contain escaped characters") \
388 : T(InvalidEscapedMetaProperty, "'%' must not contain escaped characters") \
389 : T(InvalidLhsInAssignment, "Invalid left-hand side in assignment") \
390 : T(InvalidCoverInitializedName, "Invalid shorthand property initializer") \
391 : T(InvalidDestructuringTarget, "Invalid destructuring assignment target") \
392 : T(InvalidLhsInFor, "Invalid left-hand side in for-loop") \
393 : T(InvalidLhsInPostfixOp, \
394 : "Invalid left-hand side expression in postfix operation") \
395 : T(InvalidLhsInPrefixOp, \
396 : "Invalid left-hand side expression in prefix operation") \
397 : T(InvalidRegExpFlags, "Invalid flags supplied to RegExp constructor '%'") \
398 : T(InvalidOrUnexpectedToken, "Invalid or unexpected token") \
399 : T(InvalidPrivateFieldResolution, \
400 : "Undefined private field %: must be declared in an enclosing class") \
401 : T(InvalidPrivateFieldRead, \
402 : "Read of private field % from an object which did not contain the field") \
403 : T(InvalidPrivateFieldWrite, \
404 : "Write of private field % to an object which did not contain the field") \
405 : T(JsonParseUnexpectedEOS, "Unexpected end of JSON input") \
406 : T(JsonParseUnexpectedToken, "Unexpected token % in JSON at position %") \
407 : T(JsonParseUnexpectedTokenNumber, "Unexpected number in JSON at position %") \
408 : T(JsonParseUnexpectedTokenString, "Unexpected string in JSON at position %") \
409 : T(LabelRedeclaration, "Label '%' has already been declared") \
410 : T(LabelledFunctionDeclaration, \
411 : "Labelled function declaration not allowed as the body of a control flow " \
412 : "structure") \
413 : T(MalformedArrowFunParamList, "Malformed arrow function parameter list") \
414 : T(MalformedRegExp, "Invalid regular expression: /%/: %") \
415 : T(MalformedRegExpFlags, "Invalid regular expression flags") \
416 : T(ModuleExportUndefined, "Export '%' is not defined in module") \
417 : T(HtmlCommentInModule, "HTML comments are not allowed in modules") \
418 : T(MultipleDefaultsInSwitch, \
419 : "More than one default clause in switch statement") \
420 : T(NewlineAfterThrow, "Illegal newline after throw") \
421 : T(NoCatchOrFinally, "Missing catch or finally after try") \
422 : T(ParamAfterRest, "Rest parameter must be last formal parameter") \
423 : T(FlattenPastSafeLength, \
424 : "Flattening % elements on an array-like of length % " \
425 : "is disallowed, as the total surpasses 2**53-1") \
426 : T(PushPastSafeLength, \
427 : "Pushing % elements on an array-like of length % " \
428 : "is disallowed, as the total surpasses 2**53-1") \
429 : T(ElementAfterRest, "Rest element must be last element") \
430 : T(BadSetterRestParameter, \
431 : "Setter function argument must not be a rest parameter") \
432 : T(ParamDupe, "Duplicate parameter name not allowed in this context") \
433 : T(ParenthesisInArgString, "Function arg string contains parenthesis") \
434 : T(ArgStringTerminatesParametersEarly, \
435 : "Arg string terminates parameters early") \
436 : T(UnexpectedEndOfArgString, "Unexpected end of arg string") \
437 : T(RestDefaultInitializer, \
438 : "Rest parameter may not have a default initializer") \
439 : T(RuntimeWrongNumArgs, "Runtime function given wrong number of arguments") \
440 : T(SuperNotCalled, \
441 : "Must call super constructor in derived class before accessing 'this' or " \
442 : "returning from derived constructor") \
443 : T(SingleFunctionLiteral, "Single function literal required") \
444 : T(SloppyFunction, \
445 : "In non-strict mode code, functions can only be declared at top level, " \
446 : "inside a block, or as the body of an if statement.") \
447 : T(SpeciesNotConstructor, \
448 : "object.constructor[Symbol.species] is not a constructor") \
449 : T(StrictDelete, "Delete of an unqualified identifier in strict mode.") \
450 : T(StrictEvalArguments, "Unexpected eval or arguments in strict mode") \
451 : T(StrictFunction, \
452 : "In strict mode code, functions can only be declared at top level or " \
453 : "inside a block.") \
454 : T(StrictOctalLiteral, "Octal literals are not allowed in strict mode.") \
455 : T(StrictDecimalWithLeadingZero, \
456 : "Decimals with leading zeros are not allowed in strict mode.") \
457 : T(StrictOctalEscape, \
458 : "Octal escape sequences are not allowed in strict mode.") \
459 : T(StrictWith, "Strict mode code may not include a with statement") \
460 : T(TemplateOctalLiteral, \
461 : "Octal escape sequences are not allowed in template strings.") \
462 : T(ThisFormalParameter, "'this' is not a valid formal parameter name") \
463 : T(AwaitBindingIdentifier, \
464 : "'await' is not a valid identifier name in an async function") \
465 : T(AwaitExpressionFormalParameter, \
466 : "Illegal await-expression in formal parameters of async function") \
467 : T(TooManyArguments, \
468 : "Too many arguments in function call (only 65535 allowed)") \
469 : T(TooManyParameters, \
470 : "Too many parameters in function definition (only 65534 allowed)") \
471 : T(TooManySpreads, \
472 : "Literal containing too many nested spreads (up to 65534 allowed)") \
473 : T(TooManyVariables, "Too many variables declared (only 4194303 allowed)") \
474 : T(TooManyElementsInPromiseAll, "Too many elements passed to Promise.all") \
475 : T(TypedArrayTooShort, \
476 : "Derived TypedArray constructor created an array which was too small") \
477 : T(UnexpectedEOS, "Unexpected end of input") \
478 : T(UnexpectedReserved, "Unexpected reserved word") \
479 : T(UnexpectedStrictReserved, "Unexpected strict mode reserved word") \
480 : T(UnexpectedSuper, "'super' keyword unexpected here") \
481 : T(UnexpectedNewTarget, "new.target expression is not allowed here") \
482 : T(UnexpectedTemplateString, "Unexpected template string") \
483 : T(UnexpectedToken, "Unexpected token %") \
484 : T(UnexpectedTokenIdentifier, "Unexpected identifier") \
485 : T(UnexpectedTokenNumber, "Unexpected number") \
486 : T(UnexpectedTokenString, "Unexpected string") \
487 : T(UnexpectedTokenRegExp, "Unexpected regular expression") \
488 : T(UnexpectedLexicalDeclaration, \
489 : "Lexical declaration cannot appear in a single-statement context") \
490 : T(UnknownLabel, "Undefined label '%'") \
491 : T(UnresolvableExport, \
492 : "The requested module '%' does not provide an export named '%'") \
493 : T(UnterminatedArgList, "missing ) after argument list") \
494 : T(UnterminatedRegExp, "Invalid regular expression: missing /") \
495 : T(UnterminatedTemplate, "Unterminated template literal") \
496 : T(UnterminatedTemplateExpr, "Missing } in template expression") \
497 : T(FoundNonCallableHasInstance, "Found non-callable @@hasInstance") \
498 : T(InvalidHexEscapeSequence, "Invalid hexadecimal escape sequence") \
499 : T(InvalidUnicodeEscapeSequence, "Invalid Unicode escape sequence") \
500 : T(UndefinedUnicodeCodePoint, "Undefined Unicode code-point") \
501 : T(YieldInParameter, "Yield expression not allowed in formal parameter") \
502 : /* EvalError */ \
503 : T(CodeGenFromStrings, "%") \
504 : T(NoSideEffectDebugEvaluate, "Possible side-effect in debug-evaluate") \
505 : /* URIError */ \
506 : T(URIMalformed, "URI malformed") \
507 : /* Wasm errors (currently Error) */ \
508 : T(WasmTrapUnreachable, "unreachable") \
509 : T(WasmTrapMemOutOfBounds, "memory access out of bounds") \
510 : T(WasmTrapUnalignedAccess, "operation does not support unaligned accesses") \
511 : T(WasmTrapDivByZero, "divide by zero") \
512 : T(WasmTrapDivUnrepresentable, "divide result unrepresentable") \
513 : T(WasmTrapRemByZero, "remainder by zero") \
514 : T(WasmTrapFloatUnrepresentable, "float unrepresentable in integer range") \
515 : T(WasmTrapFuncInvalid, "invalid index into function table") \
516 : T(WasmTrapFuncSigMismatch, "function signature mismatch") \
517 : T(WasmTrapTypeError, "wasm function signature contains illegal type") \
518 : T(WasmTrapDataSegmentDropped, "data segment has been dropped") \
519 : T(WasmTrapElemSegmentDropped, "element segment has been dropped") \
520 : T(WasmTrapTableOutOfBounds, "table access out of bounds") \
521 : T(WasmExceptionError, "wasm exception") \
522 : /* Asm.js validation related */ \
523 : T(AsmJsInvalid, "Invalid asm.js: %") \
524 : T(AsmJsCompiled, "Converted asm.js to WebAssembly: %") \
525 : T(AsmJsInstantiated, "Instantiated asm.js: %") \
526 : T(AsmJsLinkingFailed, "Linking failure in asm.js: %") \
527 : /* DataCloneError messages */ \
528 : T(DataCloneError, "% could not be cloned.") \
529 : T(DataCloneErrorOutOfMemory, "Data cannot be cloned, out of memory.") \
530 : T(DataCloneErrorDetachedArrayBuffer, \
531 : "An ArrayBuffer is neutered and could not be cloned.") \
532 : T(DataCloneErrorSharedArrayBufferTransferred, \
533 : "A SharedArrayBuffer could not be cloned. SharedArrayBuffer must not be " \
534 : "transferred.") \
535 : T(DataCloneDeserializationError, "Unable to deserialize cloned data.") \
536 : T(DataCloneDeserializationVersionError, \
537 : "Unable to deserialize cloned data due to invalid or unsupported " \
538 : "version.") \
539 : /* Builtins-Trace Errors */ \
540 : T(TraceEventCategoryError, "Trace event category must be a string.") \
541 : T(TraceEventNameError, "Trace event name must be a string.") \
542 : T(TraceEventNameLengthError, \
543 : "Trace event name must not be an empty string.") \
544 : T(TraceEventPhaseError, "Trace event phase must be a number.") \
545 : T(TraceEventIDError, "Trace event id must be a number.") \
546 : /* Weak refs */ \
547 : T(WeakRefsCleanupMustBeCallable, "WeakFactory: cleanup must be callable") \
548 : T(WeakRefsMakeCellTargetMustBeObject, \
549 : "WeakFactory.prototype.makeCell: target must be an object") \
550 : T(WeakRefsMakeCellTargetAndHoldingsMustNotBeSame, \
551 : "WeakFactory.prototype.makeCell: target and holdings must not be same") \
552 : T(WeakRefsWeakRefConstructorTargetMustBeObject, \
553 : "WeakRef: target must be an object") \
554 : T(WeakRefsMakeRefTargetAndHoldingsMustNotBeSame, \
555 : "WeakFactory.prototype.makeRef: target and holdings must not be same")
556 :
557 : enum class MessageTemplate {
558 : #define TEMPLATE(NAME, STRING) k##NAME,
559 : MESSAGE_TEMPLATES(TEMPLATE)
560 : #undef TEMPLATE
561 : kLastMessage
562 : };
563 :
564 255146 : inline MessageTemplate MessageTemplateFromInt(int message_id) {
565 : DCHECK_LE(0, message_id);
566 : DCHECK_LT(message_id, static_cast<int>(MessageTemplate::kLastMessage));
567 255146 : return static_cast<MessageTemplate>(message_id);
568 : }
569 :
570 : } // namespace internal
571 : } // namespace v8
572 :
573 : #endif // V8_MESSAGE_TEMPLATE_H_
|