| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 #include "src/messages.h" | 5 #include "src/messages.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/execution.h" | 8 #include "src/execution.h" |
| 9 #include "src/isolate-inl.h" | 9 #include "src/isolate-inl.h" |
| 10 #include "src/string-builder.h" | 10 #include "src/string-builder.h" |
| 11 | 11 |
| 12 namespace v8 { | 12 namespace v8 { |
| 13 namespace internal { | 13 namespace internal { |
| 14 | 14 |
| 15 MessageLocation::MessageLocation(Handle<Script> script, int start_pos, |
| 16 int end_pos) |
| 17 : script_(script), start_pos_(start_pos), end_pos_(end_pos) {} |
| 18 MessageLocation::MessageLocation(Handle<Script> script, int start_pos, |
| 19 int end_pos, Handle<JSFunction> function) |
| 20 : script_(script), |
| 21 start_pos_(start_pos), |
| 22 end_pos_(end_pos), |
| 23 function_(function) {} |
| 24 MessageLocation::MessageLocation() : start_pos_(-1), end_pos_(-1) {} |
| 15 | 25 |
| 16 // If no message listeners have been registered this one is called | 26 // If no message listeners have been registered this one is called |
| 17 // by default. | 27 // by default. |
| 18 void MessageHandler::DefaultMessageReport(Isolate* isolate, | 28 void MessageHandler::DefaultMessageReport(Isolate* isolate, |
| 19 const MessageLocation* loc, | 29 const MessageLocation* loc, |
| 20 Handle<Object> message_obj) { | 30 Handle<Object> message_obj) { |
| 21 base::SmartArrayPointer<char> str = GetLocalizedMessage(isolate, message_obj); | 31 base::SmartArrayPointer<char> str = GetLocalizedMessage(isolate, message_obj); |
| 22 if (loc == NULL) { | 32 if (loc == NULL) { |
| 23 PrintF("%s\n", str.get()); | 33 PrintF("%s\n", str.get()); |
| 24 } else { | 34 } else { |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 builder.AppendCharacter(*c); | 421 builder.AppendCharacter(*c); |
| 412 } | 422 } |
| 413 } | 423 } |
| 414 | 424 |
| 415 return builder.Finish(); | 425 return builder.Finish(); |
| 416 } | 426 } |
| 417 | 427 |
| 418 | 428 |
| 419 } // namespace internal | 429 } // namespace internal |
| 420 } // namespace v8 | 430 } // namespace v8 |
| OLD | NEW |