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

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

Issue 1130133003: Migrate error messages, part 12. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@messages_11
Patch Set: Created 5 years, 7 months 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') | src/preparse-data.h » ('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 d5f98eb6a81a610fb16f50888b9d5c628b402e60..dcc64bc8efd78c317837e66707a356d0baf9b751 100644
--- a/src/pending-compilation-error-handler.cc
+++ b/src/pending-compilation-error-handler.cc
@@ -17,29 +17,27 @@ void PendingCompilationErrorHandler::ThrowPendingError(Isolate* isolate,
if (!has_pending_error_) return;
MessageLocation location(script, start_position_, end_position_);
Factory* factory = isolate->factory();
- bool has_arg = arg_ != NULL || char_arg_ != NULL || !handle_arg_.is_null();
- Handle<FixedArray> elements = factory->NewFixedArray(has_arg ? 1 : 0);
+ Handle<String> argument;
if (arg_ != NULL) {
- Handle<String> arg_string = arg_->string();
- elements->set(0, *arg_string);
+ argument = arg_->string();
} else if (char_arg_ != NULL) {
- Handle<String> arg_string =
+ argument =
factory->NewStringFromUtf8(CStrVector(char_arg_)).ToHandleChecked();
- elements->set(0, *arg_string);
} else if (!handle_arg_.is_null()) {
- elements->set(0, *handle_arg_);
+ argument = handle_arg_;
}
isolate->debug()->OnCompileError(script);
- Handle<JSArray> array = factory->NewJSArrayWithElements(elements);
Handle<Object> error;
-
switch (error_type_) {
case kReferenceError:
- error = factory->NewError("MakeReferenceError", message_, array);
+ error = factory->NewError("MakeReferenceError", message_, argument);
break;
case kSyntaxError:
- error = factory->NewError("MakeSyntaxError", message_, array);
+ error = factory->NewError("MakeSyntaxError", message_, argument);
+ break;
+ default:
+ UNREACHABLE();
break;
}
« no previous file with comments | « src/pending-compilation-error-handler.h ('k') | src/preparse-data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698