| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 bool IsToplevel(); | 61 bool IsToplevel(); |
| 62 bool IsEval(); | 62 bool IsEval(); |
| 63 bool IsConstructor(); | 63 bool IsConstructor(); |
| 64 | 64 |
| 65 bool IsValid() { return !fun_.is_null(); } | 65 bool IsValid() { return !fun_.is_null(); } |
| 66 | 66 |
| 67 private: | 67 private: |
| 68 Isolate* isolate_; | 68 Isolate* isolate_; |
| 69 Handle<Object> receiver_; | 69 Handle<Object> receiver_; |
| 70 Handle<JSFunction> fun_; | 70 Handle<JSFunction> fun_; |
| 71 int pos_; | 71 int32_t pos_; |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 | 74 |
| 75 #define MESSAGE_TEMPLATES(T) \ | 75 #define MESSAGE_TEMPLATES(T) \ |
| 76 /* Error */ \ | 76 /* Error */ \ |
| 77 T(None, "") \ | 77 T(None, "") \ |
| 78 T(CyclicProto, "Cyclic __proto__ value") \ | 78 T(CyclicProto, "Cyclic __proto__ value") \ |
| 79 T(Debugger, "Debugger: %") \ | 79 T(Debugger, "Debugger: %") \ |
| 80 T(DebuggerLoading, "Error loading debugger") \ | 80 T(DebuggerLoading, "Error loading debugger") \ |
| 81 T(DefaultOptionsMissing, "Internal % error. Default options are missing.") \ | 81 T(DefaultOptionsMissing, "Internal % error. Default options are missing.") \ |
| 82 T(UncaughtException, "Uncaught %") \ | 82 T(UncaughtException, "Uncaught %") \ |
| 83 T(Unsupported, "Not supported") \ | 83 T(Unsupported, "Not supported") \ |
| 84 T(WrongServiceType, "Internal error, wrong service type: %") \ | 84 T(WrongServiceType, "Internal error, wrong service type: %") \ |
| 85 T(WrongValueType, "Internal error. Wrong value type.") \ | 85 T(WrongValueType, "Internal error. Wrong value type.") \ |
| 86 /* TypeError */ \ | 86 /* TypeError */ \ |
| 87 T(ApplyNonFunction, \ | 87 T(ApplyNonFunction, \ |
| 88 "Function.prototype.apply was called on %, which is a % and not a " \ | 88 "Function.prototype.apply was called on %, which is a % and not a " \ |
| 89 "function") \ | 89 "function") \ |
| 90 T(ArrayFunctionsOnFrozen, "Cannot modify frozen array elements") \ | 90 T(ArrayFunctionsOnFrozen, "Cannot modify frozen array elements") \ |
| 91 T(ArrayFunctionsOnSealed, "Cannot add/remove sealed array elements") \ | 91 T(ArrayFunctionsOnSealed, "Cannot add/remove sealed array elements") \ |
| 92 T(ArrayNotSubclassable, "Subclassing Arrays is not currently supported.") \ | 92 T(ArrayNotSubclassable, "Subclassing Arrays is not currently supported.") \ |
| 93 T(CalledNonCallable, "% is not a function") \ | 93 T(CalledNonCallable, "% is not a function") \ |
| 94 T(CalledOnNonObject, "% called on non-object") \ | 94 T(CalledOnNonObject, "% called on non-object") \ |
| 95 T(CalledOnNullOrUndefined, "% called on null or undefined") \ | 95 T(CalledOnNullOrUndefined, "% called on null or undefined") \ |
| 96 T(CallSiteExpectsFunction, \ |
| 97 "CallSite expects function as second argument, got %") \ |
| 96 T(CannotConvertToPrimitive, "Cannot convert object to primitive value") \ | 98 T(CannotConvertToPrimitive, "Cannot convert object to primitive value") \ |
| 97 T(CannotPreventExt, "Cannot prevent extensions") \ | 99 T(CannotPreventExt, "Cannot prevent extensions") \ |
| 98 T(CannotFreezeArrayBufferView, \ | 100 T(CannotFreezeArrayBufferView, \ |
| 99 "Cannot freeze array buffer views with elements") \ | 101 "Cannot freeze array buffer views with elements") \ |
| 100 T(CircularStructure, "Converting circular structure to JSON") \ | 102 T(CircularStructure, "Converting circular structure to JSON") \ |
| 101 T(ConstAssign, "Assignment to constant variable.") \ | 103 T(ConstAssign, "Assignment to constant variable.") \ |
| 102 T(ConstructorNonCallable, \ | 104 T(ConstructorNonCallable, \ |
| 103 "Class constructor % cannot be invoked without 'new'") \ | 105 "Class constructor % cannot be invoked without 'new'") \ |
| 104 T(ConstructorNotFunction, "Constructor % requires 'new'") \ | 106 T(ConstructorNotFunction, "Constructor % requires 'new'") \ |
| 105 T(CurrencyCode, "Currency code is required with currency style.") \ | 107 T(CurrencyCode, "Currency code is required with currency style.") \ |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data); | 483 static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data); |
| 482 static base::SmartArrayPointer<char> GetLocalizedMessage(Isolate* isolate, | 484 static base::SmartArrayPointer<char> GetLocalizedMessage(Isolate* isolate, |
| 483 Handle<Object> data); | 485 Handle<Object> data); |
| 484 }; | 486 }; |
| 485 | 487 |
| 486 | 488 |
| 487 } // namespace internal | 489 } // namespace internal |
| 488 } // namespace v8 | 490 } // namespace v8 |
| 489 | 491 |
| 490 #endif // V8_MESSAGES_H_ | 492 #endif // V8_MESSAGES_H_ |
| OLD | NEW |