OLD | NEW |
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 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 // V8 didn't provide any extra information about this error; just | 921 // V8 didn't provide any extra information about this error; just |
922 // print the exception. | 922 // print the exception. |
923 printf("%s\n", exception_string); | 923 printf("%s\n", exception_string); |
924 } else { | 924 } else { |
925 // Print (filename):(line number): (message). | 925 // Print (filename):(line number): (message). |
926 v8::String::Utf8Value filename(message->GetScriptOrigin().ResourceName()); | 926 v8::String::Utf8Value filename(message->GetScriptOrigin().ResourceName()); |
927 const char* filename_string = ToCString(filename); | 927 const char* filename_string = ToCString(filename); |
928 Maybe<int> maybeline = message->GetLineNumber(isolate->GetCurrentContext()); | 928 Maybe<int> maybeline = message->GetLineNumber(isolate->GetCurrentContext()); |
929 int linenum = maybeline.IsJust() ? maybeline.FromJust() : -1; | 929 int linenum = maybeline.IsJust() ? maybeline.FromJust() : -1; |
930 printf("%s:%i: %s\n", filename_string, linenum, exception_string); | 930 printf("%s:%i: %s\n", filename_string, linenum, exception_string); |
931 if (maybeline.IsJust()) { | 931 Local<String> sourceline; |
| 932 if (message->GetSourceLine(isolate->GetCurrentContext()) |
| 933 .ToLocal(&sourceline)) { |
932 // Print line of source code. | 934 // Print line of source code. |
933 v8::String::Utf8Value sourceline( | 935 v8::String::Utf8Value sourcelinevalue(sourceline); |
934 message->GetSourceLine(isolate->GetCurrentContext()) | 936 const char* sourceline_string = ToCString(sourcelinevalue); |
935 .ToLocalChecked()); | |
936 const char* sourceline_string = ToCString(sourceline); | |
937 printf("%s\n", sourceline_string); | 937 printf("%s\n", sourceline_string); |
938 // Print wavy underline (GetUnderline is deprecated). | 938 // Print wavy underline (GetUnderline is deprecated). |
939 int start = | 939 int start = |
940 message->GetStartColumn(isolate->GetCurrentContext()).FromJust(); | 940 message->GetStartColumn(isolate->GetCurrentContext()).FromJust(); |
941 for (int i = 0; i < start; i++) { | 941 for (int i = 0; i < start; i++) { |
942 printf(" "); | 942 printf(" "); |
943 } | 943 } |
944 int end = message->GetEndColumn(isolate->GetCurrentContext()).FromJust(); | 944 int end = message->GetEndColumn(isolate->GetCurrentContext()).FromJust(); |
945 for (int i = start; i < end; i++) { | 945 for (int i = start; i < end; i++) { |
946 printf("^"); | 946 printf("^"); |
(...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2550 } | 2550 } |
2551 | 2551 |
2552 } // namespace v8 | 2552 } // namespace v8 |
2553 | 2553 |
2554 | 2554 |
2555 #ifndef GOOGLE3 | 2555 #ifndef GOOGLE3 |
2556 int main(int argc, char* argv[]) { | 2556 int main(int argc, char* argv[]) { |
2557 return v8::Shell::Main(argc, argv); | 2557 return v8::Shell::Main(argc, argv); |
2558 } | 2558 } |
2559 #endif | 2559 #endif |
OLD | NEW |