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_ |
11 #define V8_MESSAGES_H_ | 11 #define V8_MESSAGES_H_ |
12 | 12 |
13 #include "src/handles-inl.h" | |
14 | |
15 // Forward declaration of MessageLocation. | 13 // Forward declaration of MessageLocation. |
16 namespace v8 { | 14 namespace v8 { |
17 namespace internal { | 15 namespace internal { |
18 class MessageLocation; | 16 class MessageLocation; |
19 } } // namespace v8::internal | 17 } } // namespace v8::internal |
20 | 18 |
21 | 19 |
22 class V8Message { | 20 class V8Message { |
23 public: | 21 public: |
24 V8Message(char* type, | 22 V8Message(char* type, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 Handle<Object> message); | 80 Handle<Object> message); |
83 | 81 |
84 static void DefaultMessageReport(Isolate* isolate, | 82 static void DefaultMessageReport(Isolate* isolate, |
85 const MessageLocation* loc, | 83 const MessageLocation* loc, |
86 Handle<Object> message_obj); | 84 Handle<Object> message_obj); |
87 static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data); | 85 static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data); |
88 static SmartArrayPointer<char> GetLocalizedMessage(Isolate* isolate, | 86 static SmartArrayPointer<char> GetLocalizedMessage(Isolate* isolate, |
89 Handle<Object> data); | 87 Handle<Object> data); |
90 }; | 88 }; |
91 | 89 |
| 90 |
| 91 #define MESSAGE_TEMPLATES(T) \ |
| 92 T(PropertyNotFunction, "Property '%' of object % is not a function") \ |
| 93 T(WithExpression, "% has no properties") |
| 94 |
| 95 class MessageTemplate { |
| 96 public: |
| 97 enum Template { |
| 98 #define TEMPLATE(NAME, STRING) k##NAME, |
| 99 MESSAGE_TEMPLATES(TEMPLATE) |
| 100 #undef TEMPLATE |
| 101 kLastMessage |
| 102 }; |
| 103 |
| 104 static MaybeHandle<String> FormatMessage(int template_index, |
| 105 Handle<String> arg0, |
| 106 Handle<String> arg1, |
| 107 Handle<String> arg2); |
| 108 }; |
92 } } // namespace v8::internal | 109 } } // namespace v8::internal |
93 | 110 |
94 #endif // V8_MESSAGES_H_ | 111 #endif // V8_MESSAGES_H_ |
OLD | NEW |