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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 static void DefaultMessageReport(Isolate* isolate, | 82 static void DefaultMessageReport(Isolate* isolate, |
83 const MessageLocation* loc, | 83 const MessageLocation* loc, |
84 Handle<Object> message_obj); | 84 Handle<Object> message_obj); |
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 T(PropertyNotFunction, "Property '%' of object % is not a function") \ | 92 /* Error */ \ |
93 T(WithExpression, "% has no properties") | 93 T(CyclicProto, "Cyclic __proto__ value") \ |
| 94 /* TypeError */ \ |
| 95 T(CalledNonCallable, "% is not a function") \ |
| 96 T(GeneratorRunning, "Generator is already running") \ |
| 97 T(IncompatibleMethodReceiver, "Method % called on incompatible receiver %") \ |
| 98 T(PropertyNotFunction, "Property '%' of object % is not a function") \ |
| 99 T(WithExpression, "% has no properties") \ |
| 100 /* EvalError */ \ |
| 101 T(CodeGenFromStrings, "%") |
94 | 102 |
95 class MessageTemplate { | 103 class MessageTemplate { |
96 public: | 104 public: |
97 enum Template { | 105 enum Template { |
98 #define TEMPLATE(NAME, STRING) k##NAME, | 106 #define TEMPLATE(NAME, STRING) k##NAME, |
99 MESSAGE_TEMPLATES(TEMPLATE) | 107 MESSAGE_TEMPLATES(TEMPLATE) |
100 #undef TEMPLATE | 108 #undef TEMPLATE |
101 kLastMessage | 109 kLastMessage |
102 }; | 110 }; |
103 | 111 |
104 static MaybeHandle<String> FormatMessage(int template_index, | 112 static MaybeHandle<String> FormatMessage(int template_index, |
105 Handle<String> arg0, | 113 Handle<String> arg0, |
106 Handle<String> arg1, | 114 Handle<String> arg1, |
107 Handle<String> arg2); | 115 Handle<String> arg2); |
108 }; | 116 }; |
109 } } // namespace v8::internal | 117 } } // namespace v8::internal |
110 | 118 |
111 #endif // V8_MESSAGES_H_ | 119 #endif // V8_MESSAGES_H_ |
OLD | NEW |