OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/pending-compilation-error-handler.h" | 5 #include "src/pending-compilation-error-handler.h" |
6 | 6 |
7 #include "src/ast/ast-value-factory.h" | 7 #include "src/ast/ast-value-factory.h" |
8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
9 #include "src/handles.h" | 9 #include "src/handles.h" |
10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
11 #include "src/messages.h" | 11 #include "src/messages.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
16 Handle<String> PendingCompilationErrorHandler::ArgumentString( | 16 Handle<String> PendingCompilationErrorHandler::ArgumentString( |
17 Isolate* isolate) { | 17 Isolate* isolate) { |
18 if (arg_ != NULL) return arg_->string(); | 18 if (arg_ != NULL) return arg_->string(); |
19 if (char_arg_ != NULL) { | 19 if (char_arg_ != NULL) { |
20 return isolate->factory() | 20 return isolate->factory() |
21 ->NewStringFromUtf8(CStrVector(char_arg_)) | 21 ->NewStringFromUtf8(CStrVector(char_arg_)) |
22 .ToHandleChecked(); | 22 .ToHandleChecked(); |
23 } | 23 } |
| 24 if (!handle_arg_.is_null()) return handle_arg_; |
24 return isolate->factory()->undefined_string(); | 25 return isolate->factory()->undefined_string(); |
25 } | 26 } |
26 | 27 |
27 Handle<String> PendingCompilationErrorHandler::FormatMessage(Isolate* isolate) { | 28 Handle<String> PendingCompilationErrorHandler::FormatMessage(Isolate* isolate) { |
28 return MessageTemplate::FormatMessage(isolate, message_, | 29 return MessageTemplate::FormatMessage(isolate, message_, |
29 ArgumentString(isolate)); | 30 ArgumentString(isolate)); |
30 } | 31 } |
31 | 32 |
32 void PendingCompilationErrorHandler::ThrowPendingError(Isolate* isolate, | 33 void PendingCompilationErrorHandler::ThrowPendingError(Isolate* isolate, |
33 Handle<Script> script) { | 34 Handle<Script> script) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 handle(Smi::FromInt(location.end_pos()), isolate), | 68 handle(Smi::FromInt(location.end_pos()), isolate), |
68 SLOPPY).Check(); | 69 SLOPPY).Check(); |
69 | 70 |
70 Handle<Name> key_script = factory->error_script_symbol(); | 71 Handle<Name> key_script = factory->error_script_symbol(); |
71 JSObject::SetProperty(jserror, key_script, script, SLOPPY).Check(); | 72 JSObject::SetProperty(jserror, key_script, script, SLOPPY).Check(); |
72 | 73 |
73 isolate->Throw(*error, &location); | 74 isolate->Throw(*error, &location); |
74 } | 75 } |
75 } // namespace internal | 76 } // namespace internal |
76 } // namespace v8 | 77 } // namespace v8 |
OLD | NEW |