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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 "Function.prototype.apply was called on %, which is a % and not a " \ | 87 "Function.prototype.apply was called on %, which is a % and not a " \ |
88 "function") \ | 88 "function") \ |
89 T(ArrayBufferTooShort, \ | 89 T(ArrayBufferTooShort, \ |
90 "Derived ArrayBuffer constructor created a buffer which was too small") \ | 90 "Derived ArrayBuffer constructor created a buffer which was too small") \ |
91 T(ArrayBufferSpeciesThis, \ | 91 T(ArrayBufferSpeciesThis, \ |
92 "ArrayBuffer subclass returned this from species constructor") \ | 92 "ArrayBuffer subclass returned this from species constructor") \ |
93 T(ArrayFunctionsOnFrozen, "Cannot modify frozen array elements") \ | 93 T(ArrayFunctionsOnFrozen, "Cannot modify frozen array elements") \ |
94 T(ArrayFunctionsOnSealed, "Cannot add/remove sealed array elements") \ | 94 T(ArrayFunctionsOnSealed, "Cannot add/remove sealed array elements") \ |
95 T(ArrayNotSubclassable, "Subclassing Arrays is not currently supported.") \ | 95 T(ArrayNotSubclassable, "Subclassing Arrays is not currently supported.") \ |
96 T(CalledNonCallable, "% is not a function") \ | 96 T(CalledNonCallable, "% is not a function") \ |
97 T(CalledNonCallableInstanceOf, "right-hand side is not a function") \ | 97 T(CalledNonCallableInstanceOf, \ |
| 98 "Right-hand side of 'instanceof' is not callable") \ |
98 T(CalledOnNonObject, "% called on non-object") \ | 99 T(CalledOnNonObject, "% called on non-object") \ |
99 T(CalledOnNullOrUndefined, "% called on null or undefined") \ | 100 T(CalledOnNullOrUndefined, "% called on null or undefined") \ |
100 T(CallSiteExpectsFunction, \ | 101 T(CallSiteExpectsFunction, \ |
101 "CallSite expects function as second argument, got %") \ | 102 "CallSite expects function as second argument, got %") \ |
102 T(CannotConvertToPrimitive, "Cannot convert object to primitive value") \ | 103 T(CannotConvertToPrimitive, "Cannot convert object to primitive value") \ |
103 T(CannotPreventExt, "Cannot prevent extensions") \ | 104 T(CannotPreventExt, "Cannot prevent extensions") \ |
104 T(CannotFreezeArrayBufferView, \ | 105 T(CannotFreezeArrayBufferView, \ |
105 "Cannot freeze array buffer views with elements") \ | 106 "Cannot freeze array buffer views with elements") \ |
106 T(CircularStructure, "Converting circular structure to JSON") \ | 107 T(CircularStructure, "Converting circular structure to JSON") \ |
107 T(ConstructAbstractClass, "Abstract class % not directly constructable") \ | 108 T(ConstructAbstractClass, "Abstract class % not directly constructable") \ |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 T(IteratorValueNotAnObject, "Iterator value % is not an entry object") \ | 141 T(IteratorValueNotAnObject, "Iterator value % is not an entry object") \ |
141 T(LanguageID, "Language ID should be string or object.") \ | 142 T(LanguageID, "Language ID should be string or object.") \ |
142 T(MethodCalledOnWrongObject, \ | 143 T(MethodCalledOnWrongObject, \ |
143 "Method % called on a non-object or on a wrong type of object.") \ | 144 "Method % called on a non-object or on a wrong type of object.") \ |
144 T(MethodInvokedOnNullOrUndefined, \ | 145 T(MethodInvokedOnNullOrUndefined, \ |
145 "Method invoked on undefined or null value.") \ | 146 "Method invoked on undefined or null value.") \ |
146 T(MethodInvokedOnWrongType, "Method invoked on an object that is not %.") \ | 147 T(MethodInvokedOnWrongType, "Method invoked on an object that is not %.") \ |
147 T(NoAccess, "no access") \ | 148 T(NoAccess, "no access") \ |
148 T(NonCoercible, "Cannot match against 'undefined' or 'null'.") \ | 149 T(NonCoercible, "Cannot match against 'undefined' or 'null'.") \ |
149 T(NonExtensibleProto, "% is not extensible") \ | 150 T(NonExtensibleProto, "% is not extensible") \ |
| 151 T(NonObjectInInstanceOfCheck, \ |
| 152 "Right-hand side of 'instanceof' is not an object") \ |
150 T(NonObjectPropertyLoad, "Cannot read property '%' of %") \ | 153 T(NonObjectPropertyLoad, "Cannot read property '%' of %") \ |
151 T(NonObjectPropertyStore, "Cannot set property '%' of %") \ | 154 T(NonObjectPropertyStore, "Cannot set property '%' of %") \ |
152 T(NoSetterInCallback, "Cannot set property % of % which has only a getter") \ | 155 T(NoSetterInCallback, "Cannot set property % of % which has only a getter") \ |
153 T(NotAnIterator, "% is not an iterator") \ | 156 T(NotAnIterator, "% is not an iterator") \ |
154 T(NotAPromise, "% is not a promise") \ | 157 T(NotAPromise, "% is not a promise") \ |
155 T(NotConstructor, "% is not a constructor") \ | 158 T(NotConstructor, "% is not a constructor") \ |
156 T(NotDateObject, "this is not a Date object.") \ | 159 T(NotDateObject, "this is not a Date object.") \ |
157 T(NotIntlObject, "% is not an i18n object.") \ | 160 T(NotIntlObject, "% is not an i18n object.") \ |
158 T(NotGeneric, "% is not generic") \ | 161 T(NotGeneric, "% is not generic") \ |
159 T(NotIterable, "% is not iterable") \ | 162 T(NotIterable, "% is not iterable") \ |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 T(UnexpectedTokenIdentifier, "Unexpected identifier") \ | 457 T(UnexpectedTokenIdentifier, "Unexpected identifier") \ |
455 T(UnexpectedTokenNumber, "Unexpected number") \ | 458 T(UnexpectedTokenNumber, "Unexpected number") \ |
456 T(UnexpectedTokenString, "Unexpected string") \ | 459 T(UnexpectedTokenString, "Unexpected string") \ |
457 T(UnexpectedTokenRegExp, "Unexpected regular expression") \ | 460 T(UnexpectedTokenRegExp, "Unexpected regular expression") \ |
458 T(UnknownLabel, "Undefined label '%'") \ | 461 T(UnknownLabel, "Undefined label '%'") \ |
459 T(UnterminatedArgList, "missing ) after argument list") \ | 462 T(UnterminatedArgList, "missing ) after argument list") \ |
460 T(UnterminatedRegExp, "Invalid regular expression: missing /") \ | 463 T(UnterminatedRegExp, "Invalid regular expression: missing /") \ |
461 T(UnterminatedTemplate, "Unterminated template literal") \ | 464 T(UnterminatedTemplate, "Unterminated template literal") \ |
462 T(UnterminatedTemplateExpr, "Missing } in template expression") \ | 465 T(UnterminatedTemplateExpr, "Missing } in template expression") \ |
463 T(FoundNonCallableHasInstance, "Found non-callable @@hasInstance") \ | 466 T(FoundNonCallableHasInstance, "Found non-callable @@hasInstance") \ |
464 T(NonObjectInInstanceOfCheck, "right-hand side is not an object") \ | |
465 /* EvalError */ \ | 467 /* EvalError */ \ |
466 T(CodeGenFromStrings, "%") \ | 468 T(CodeGenFromStrings, "%") \ |
467 /* URIError */ \ | 469 /* URIError */ \ |
468 T(URIMalformed, "URI malformed") | 470 T(URIMalformed, "URI malformed") |
469 | 471 |
470 class MessageTemplate { | 472 class MessageTemplate { |
471 public: | 473 public: |
472 enum Template { | 474 enum Template { |
473 #define TEMPLATE(NAME, STRING) k##NAME, | 475 #define TEMPLATE(NAME, STRING) k##NAME, |
474 MESSAGE_TEMPLATES(TEMPLATE) | 476 MESSAGE_TEMPLATES(TEMPLATE) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data); | 509 static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data); |
508 static base::SmartArrayPointer<char> GetLocalizedMessage(Isolate* isolate, | 510 static base::SmartArrayPointer<char> GetLocalizedMessage(Isolate* isolate, |
509 Handle<Object> data); | 511 Handle<Object> data); |
510 }; | 512 }; |
511 | 513 |
512 | 514 |
513 } // namespace internal | 515 } // namespace internal |
514 } // namespace v8 | 516 } // namespace v8 |
515 | 517 |
516 #endif // V8_MESSAGES_H_ | 518 #endif // V8_MESSAGES_H_ |
OLD | NEW |