Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(613)

Side by Side Diff: src/d8.cc

Issue 265593002: Add v8::Message::GetScriptOrigin() with tests (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/api.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 5
6 // Defined when linking against shared lib on Windows. 6 // Defined when linking against shared lib on Windows.
7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED) 7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED)
8 #define V8_SHARED 8 #define V8_SHARED
9 #endif 9 #endif
10 10
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 #endif // !V8_SHARED 545 #endif // !V8_SHARED
546 v8::String::Utf8Value exception(try_catch->Exception()); 546 v8::String::Utf8Value exception(try_catch->Exception());
547 const char* exception_string = ToCString(exception); 547 const char* exception_string = ToCString(exception);
548 Handle<Message> message = try_catch->Message(); 548 Handle<Message> message = try_catch->Message();
549 if (message.IsEmpty()) { 549 if (message.IsEmpty()) {
550 // V8 didn't provide any extra information about this error; just 550 // V8 didn't provide any extra information about this error; just
551 // print the exception. 551 // print the exception.
552 printf("%s\n", exception_string); 552 printf("%s\n", exception_string);
553 } else { 553 } else {
554 // Print (filename):(line number): (message). 554 // Print (filename):(line number): (message).
555 v8::String::Utf8Value filename(message->GetScriptResourceName()); 555 v8::String::Utf8Value filename(message->GetScriptOrigin().ResourceName());
556 const char* filename_string = ToCString(filename); 556 const char* filename_string = ToCString(filename);
557 int linenum = message->GetLineNumber(); 557 int linenum = message->GetLineNumber();
558 printf("%s:%i: %s\n", filename_string, linenum, exception_string); 558 printf("%s:%i: %s\n", filename_string, linenum, exception_string);
559 // Print line of source code. 559 // Print line of source code.
560 v8::String::Utf8Value sourceline(message->GetSourceLine()); 560 v8::String::Utf8Value sourceline(message->GetSourceLine());
561 const char* sourceline_string = ToCString(sourceline); 561 const char* sourceline_string = ToCString(sourceline);
562 printf("%s\n", sourceline_string); 562 printf("%s\n", sourceline_string);
563 // Print wavy underline (GetUnderline is deprecated). 563 // Print wavy underline (GetUnderline is deprecated).
564 int start = message->GetStartColumn(); 564 int start = message->GetStartColumn();
565 for (int i = 0; i < start; i++) { 565 for (int i = 0; i < start; i++) {
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after
1560 } 1560 }
1561 1561
1562 } // namespace v8 1562 } // namespace v8
1563 1563
1564 1564
1565 #ifndef GOOGLE3 1565 #ifndef GOOGLE3
1566 int main(int argc, char* argv[]) { 1566 int main(int argc, char* argv[]) {
1567 return v8::Shell::Main(argc, argv); 1567 return v8::Shell::Main(argc, argv);
1568 } 1568 }
1569 #endif 1569 #endif
OLDNEW
« no previous file with comments | « src/api.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698