| 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_; | |
| 25 return isolate->factory()->undefined_string(); | 24 return isolate->factory()->undefined_string(); |
| 26 } | 25 } |
| 27 | 26 |
| 28 Handle<String> PendingCompilationErrorHandler::FormatMessage(Isolate* isolate) { | 27 Handle<String> PendingCompilationErrorHandler::FormatMessage(Isolate* isolate) { |
| 29 return MessageTemplate::FormatMessage(isolate, message_, | 28 return MessageTemplate::FormatMessage(isolate, message_, |
| 30 ArgumentString(isolate)); | 29 ArgumentString(isolate)); |
| 31 } | 30 } |
| 32 | 31 |
| 33 void PendingCompilationErrorHandler::ThrowPendingError(Isolate* isolate, | 32 void PendingCompilationErrorHandler::ThrowPendingError(Isolate* isolate, |
| 34 Handle<Script> script) { | 33 Handle<Script> script) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 handle(Smi::FromInt(location.end_pos()), isolate), | 67 handle(Smi::FromInt(location.end_pos()), isolate), |
| 69 SLOPPY).Check(); | 68 SLOPPY).Check(); |
| 70 | 69 |
| 71 Handle<Name> key_script = factory->error_script_symbol(); | 70 Handle<Name> key_script = factory->error_script_symbol(); |
| 72 JSObject::SetProperty(jserror, key_script, script, SLOPPY).Check(); | 71 JSObject::SetProperty(jserror, key_script, script, SLOPPY).Check(); |
| 73 | 72 |
| 74 isolate->Throw(*error, &location); | 73 isolate->Throw(*error, &location); |
| 75 } | 74 } |
| 76 } // namespace internal | 75 } // namespace internal |
| 77 } // namespace v8 | 76 } // namespace v8 |
| OLD | NEW |