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

Unified Diff: src/pending-compilation-error-handler.cc

Issue 2502633002: [parser] Only log messages using the pending error handling (Closed)
Patch Set: Delete more unused code Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pending-compilation-error-handler.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « src/pending-compilation-error-handler.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698