Index: src/pending-compilation-error-handler.cc |
diff --git a/src/pending-compilation-error-handler.cc b/src/pending-compilation-error-handler.cc |
index 3e88efc9998142e3aa4596a62b9741098c367995..8f7660dd6b3e02966b997711100e0d67b2e79aa7 100644 |
--- a/src/pending-compilation-error-handler.cc |
+++ b/src/pending-compilation-error-handler.cc |
@@ -13,20 +13,29 @@ |
namespace v8 { |
namespace internal { |
+Handle<String> PendingCompilationErrorHandler::ArgumentString( |
+ Isolate* isolate) { |
+ if (arg_ != NULL) return arg_->string(); |
+ if (char_arg_ != NULL) { |
+ return isolate->factory() |
+ ->NewStringFromUtf8(CStrVector(char_arg_)) |
+ .ToHandleChecked(); |
+ } |
+ if (!handle_arg_.is_null()) return handle_arg_; |
+ return isolate->factory()->undefined_string(); |
+} |
+ |
+Handle<String> PendingCompilationErrorHandler::FormatMessage(Isolate* isolate) { |
vogelheim
2016/11/15 08:43:42
Who calls this? Is it only for testing?
Toon Verwaest
2016/11/15 10:12:24
Yeah just testing. It seems small enough that it d
|
+ return MessageTemplate::FormatMessage(isolate, message_, |
+ ArgumentString(isolate)); |
+} |
+ |
void PendingCompilationErrorHandler::ThrowPendingError(Isolate* isolate, |
Handle<Script> script) { |
if (!has_pending_error_) return; |
MessageLocation location(script, start_position_, end_position_); |
Factory* factory = isolate->factory(); |
- Handle<String> argument; |
- if (arg_ != NULL) { |
- argument = arg_->string(); |
- } else if (char_arg_ != NULL) { |
- argument = |
- factory->NewStringFromUtf8(CStrVector(char_arg_)).ToHandleChecked(); |
- } else if (!handle_arg_.is_null()) { |
- argument = handle_arg_; |
- } |
+ Handle<String> argument = ArgumentString(isolate); |
isolate->debug()->OnCompileError(script); |
Handle<Object> error; |