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 /* Error */ \ | 92 T(PropertyNotFunction, "Property '%' of object % is not a function") \ |
93 T(CyclicProto, "Cyclic __proto__ value") \ | 93 T(WithExpression, "% has no properties") |
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, "%") | |
102 | 94 |
103 class MessageTemplate { | 95 class MessageTemplate { |
104 public: | 96 public: |
105 enum Template { | 97 enum Template { |
106 #define TEMPLATE(NAME, STRING) k##NAME, | 98 #define TEMPLATE(NAME, STRING) k##NAME, |
107 MESSAGE_TEMPLATES(TEMPLATE) | 99 MESSAGE_TEMPLATES(TEMPLATE) |
108 #undef TEMPLATE | 100 #undef TEMPLATE |
109 kLastMessage | 101 kLastMessage |
110 }; | 102 }; |
111 | 103 |
112 static MaybeHandle<String> FormatMessage(int template_index, | 104 static MaybeHandle<String> FormatMessage(int template_index, |
113 Handle<String> arg0, | 105 Handle<String> arg0, |
114 Handle<String> arg1, | 106 Handle<String> arg1, |
115 Handle<String> arg2); | 107 Handle<String> arg2); |
116 }; | 108 }; |
117 } } // namespace v8::internal | 109 } } // namespace v8::internal |
118 | 110 |
119 #endif // V8_MESSAGES_H_ | 111 #endif // V8_MESSAGES_H_ |
OLD | NEW |