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

Unified Diff: src/ostreams.cc

Issue 882973002: [turbofan] Improve JSON output (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Nits Created 5 years, 11 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
Index: src/ostreams.cc
diff --git a/src/ostreams.cc b/src/ostreams.cc
index 1385e7cf315a71c964e22e1d5fdad34e72f8b400..b3c1412730ef074b4912876334731a0d9939dbb9 100644
--- a/src/ostreams.cc
+++ b/src/ostreams.cc
@@ -66,6 +66,24 @@ std::ostream& operator<<(std::ostream& os, const AsReversiblyEscapedUC16& c) {
}
+std::ostream& operator<<(std::ostream& os, const AsEscapedUC16ForJSON& c) {
+ if (c.value == '\n') {
Sven Panne 2015/01/28 15:00:43 I think a 'comb-like' pattern plus inserting strin
danno 2015/01/28 15:30:12 Done.
+ os << '\\';
+ return os << 'n';
+ } else if (c.value == '\r') {
+ os << '\\';
+ return os << 'r';
+ } else if (c.value == '\'') {
+ os << '\\';
+ return os << '\'';
+ } else if (c.value == '\"') {
+ os << '\\';
+ return os << '\"';
+ }
+ return PrintUC16(os, c.value, IsOK);
+}
+
+
std::ostream& operator<<(std::ostream& os, const AsUC16& c) {
return PrintUC16(os, c.value, IsPrint);
}

Powered by Google App Engine
This is Rietveld 408576698