| 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 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 | 37 |
| 38 namespace v8 { | 38 namespace v8 { |
| 39 namespace internal { | 39 namespace internal { |
| 40 | 40 |
| 41 struct Language; | 41 struct Language; |
| 42 class SourceInfo; | 42 class SourceInfo; |
| 43 | 43 |
| 44 class MessageLocation { | 44 class MessageLocation { |
| 45 public: | 45 public: |
| 46 MessageLocation(Handle<Script> script, | 46 MessageLocation(Handle<Script> script, int start_pos, int end_pos, |
| 47 int start_pos, | 47 Handle<JSFunction> function = Handle<JSFunction>()) |
| 48 int end_pos) | |
| 49 : script_(script), | 48 : script_(script), |
| 50 start_pos_(start_pos), | 49 start_pos_(start_pos), |
| 51 end_pos_(end_pos) { } | 50 end_pos_(end_pos), |
| 51 function_(function) {} |
| 52 MessageLocation() : start_pos_(-1), end_pos_(-1) { } | 52 MessageLocation() : start_pos_(-1), end_pos_(-1) { } |
| 53 | 53 |
| 54 Handle<Script> script() const { return script_; } | 54 Handle<Script> script() const { return script_; } |
| 55 int start_pos() const { return start_pos_; } | 55 int start_pos() const { return start_pos_; } |
| 56 int end_pos() const { return end_pos_; } | 56 int end_pos() const { return end_pos_; } |
| 57 Handle<JSFunction> function() const { return function_; } |
| 57 | 58 |
| 58 private: | 59 private: |
| 59 Handle<Script> script_; | 60 Handle<Script> script_; |
| 60 int start_pos_; | 61 int start_pos_; |
| 61 int end_pos_; | 62 int end_pos_; |
| 63 Handle<JSFunction> function_; |
| 62 }; | 64 }; |
| 63 | 65 |
| 64 | 66 |
| 65 // A message handler is a convenience interface for accessing the list | 67 // A message handler is a convenience interface for accessing the list |
| 66 // of message listeners registered in an environment | 68 // of message listeners registered in an environment |
| 67 class MessageHandler { | 69 class MessageHandler { |
| 68 public: | 70 public: |
| 69 // Returns a message object for the API to use. | 71 // Returns a message object for the API to use. |
| 70 static Handle<JSMessageObject> MakeMessageObject( | 72 static Handle<JSMessageObject> MakeMessageObject( |
| 71 Isolate* isolate, | 73 Isolate* isolate, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 83 const MessageLocation* loc, | 85 const MessageLocation* loc, |
| 84 Handle<Object> message_obj); | 86 Handle<Object> message_obj); |
| 85 static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data); | 87 static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data); |
| 86 static SmartArrayPointer<char> GetLocalizedMessage(Isolate* isolate, | 88 static SmartArrayPointer<char> GetLocalizedMessage(Isolate* isolate, |
| 87 Handle<Object> data); | 89 Handle<Object> data); |
| 88 }; | 90 }; |
| 89 | 91 |
| 90 } } // namespace v8::internal | 92 } } // namespace v8::internal |
| 91 | 93 |
| 92 #endif // V8_MESSAGES_H_ | 94 #endif // V8_MESSAGES_H_ |
| OLD | NEW |