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

Unified Diff: src/messages.cc

Issue 1295093002: Do not use js builtins object when constructing an error. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix failures. Created 5 years, 4 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/messages.h ('k') | src/messages.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/messages.cc
diff --git a/src/messages.cc b/src/messages.cc
index c7a44761a49a58a9d43ca2bdad640566f4e1b8a8..4e0c45f0f1992ca70ed191bfe63c6a4fac4bed7c 100644
--- a/src/messages.cc
+++ b/src/messages.cc
@@ -322,23 +322,29 @@ Handle<String> MessageTemplate::FormatMessage(Isolate* isolate,
}
-MaybeHandle<String> MessageTemplate::FormatMessage(int template_index,
- Handle<String> arg0,
- Handle<String> arg1,
- Handle<String> arg2) {
- Isolate* isolate = arg0->GetIsolate();
- const char* template_string;
+const char* MessageTemplate::TemplateString(int template_index) {
switch (template_index) {
-#define CASE(NAME, STRING) \
- case k##NAME: \
- template_string = STRING; \
- break;
+#define CASE(NAME, STRING) \
+ case k##NAME: \
+ return STRING;
MESSAGE_TEMPLATES(CASE)
#undef CASE
case kLastMessage:
default:
- isolate->ThrowIllegalOperation();
- return MaybeHandle<String>();
+ return NULL;
+ }
+}
+
+
+MaybeHandle<String> MessageTemplate::FormatMessage(int template_index,
+ Handle<String> arg0,
+ Handle<String> arg1,
+ Handle<String> arg2) {
+ Isolate* isolate = arg0->GetIsolate();
+ const char* template_string = TemplateString(template_index);
+ if (template_string == NULL) {
+ isolate->ThrowIllegalOperation();
+ return MaybeHandle<String>();
}
IncrementalStringBuilder builder(isolate);
« no previous file with comments | « src/messages.h ('k') | src/messages.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698