| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data); | 85 static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data); |
| 86 static SmartArrayPointer<char> GetLocalizedMessage(Isolate* isolate, | 86 static SmartArrayPointer<char> GetLocalizedMessage(Isolate* isolate, |
| 87 Handle<Object> data); | 87 Handle<Object> data); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 | 90 |
| 91 #define MESSAGE_TEMPLATES(T) \ | 91 #define MESSAGE_TEMPLATES(T) \ |
| 92 /* Error */ \ | 92 /* Error */ \ |
| 93 T(CyclicProto, "Cyclic __proto__ value") \ | 93 T(CyclicProto, "Cyclic __proto__ value") \ |
| 94 /* TypeError */ \ | 94 /* TypeError */ \ |
| 95 T(ApplyNonFunction, \ |
| 96 "Function.prototype.apply was called on %, which is a % and not a " \ |
| 97 "function") \ |
| 95 T(CalledNonCallable, "% is not a function") \ | 98 T(CalledNonCallable, "% is not a function") \ |
| 99 T(CannotConvertToPrimitive, "Cannot convert object to primitive value") \ |
| 96 T(GeneratorRunning, "Generator is already running") \ | 100 T(GeneratorRunning, "Generator is already running") \ |
| 97 T(IncompatibleMethodReceiver, "Method % called on incompatible receiver %") \ | 101 T(IncompatibleMethodReceiver, "Method % called on incompatible receiver %") \ |
| 102 T(InstanceofFunctionExpected, \ |
| 103 "Expecting a function in instanceof check, but got %") \ |
| 104 T(InstanceofNonobjectProto, \ |
| 105 "Function has non-object prototype '%' in instanceof check") \ |
| 106 T(InvalidInOperatorUse, "Cannot use 'in' operator to search for '%' in %") \ |
| 107 T(NotConstructor, "% is not a constructor") \ |
| 98 T(PropertyNotFunction, "Property '%' of object % is not a function") \ | 108 T(PropertyNotFunction, "Property '%' of object % is not a function") \ |
| 109 T(SymbolToPrimitive, \ |
| 110 "Cannot convert a Symbol wrapper object to a primitive value") \ |
| 111 T(SymbolToNumber, "Cannot convert a Symbol value to a number") \ |
| 112 T(SymbolToString, "Cannot convert a Symbol value to a string") \ |
| 113 T(UndefinedOrNullToObject, "Cannot convert undefined or null to object") \ |
| 99 T(WithExpression, "% has no properties") \ | 114 T(WithExpression, "% has no properties") \ |
| 115 T(WrongArgs, "%: Arguments list has wrong type") \ |
| 116 /* RangeError */ \ |
| 117 T(StackOverflow, "Maximum call stack size exceeded") \ |
| 100 /* EvalError */ \ | 118 /* EvalError */ \ |
| 101 T(CodeGenFromStrings, "%") | 119 T(CodeGenFromStrings, "%") |
| 102 | 120 |
| 103 class MessageTemplate { | 121 class MessageTemplate { |
| 104 public: | 122 public: |
| 105 enum Template { | 123 enum Template { |
| 106 #define TEMPLATE(NAME, STRING) k##NAME, | 124 #define TEMPLATE(NAME, STRING) k##NAME, |
| 107 MESSAGE_TEMPLATES(TEMPLATE) | 125 MESSAGE_TEMPLATES(TEMPLATE) |
| 108 #undef TEMPLATE | 126 #undef TEMPLATE |
| 109 kLastMessage | 127 kLastMessage |
| 110 }; | 128 }; |
| 111 | 129 |
| 112 static MaybeHandle<String> FormatMessage(int template_index, | 130 static MaybeHandle<String> FormatMessage(int template_index, |
| 113 Handle<String> arg0, | 131 Handle<String> arg0, |
| 114 Handle<String> arg1, | 132 Handle<String> arg1, |
| 115 Handle<String> arg2); | 133 Handle<String> arg2); |
| 116 }; | 134 }; |
| 117 } } // namespace v8::internal | 135 } } // namespace v8::internal |
| 118 | 136 |
| 119 #endif // V8_MESSAGES_H_ | 137 #endif // V8_MESSAGES_H_ |
| OLD | NEW |