Index: src/string-stream.h |
diff --git a/src/string-stream.h b/src/string-stream.h |
index 0ba8f52d44033d842a4f22a9c3bf1844f9a75986..88b4afe115f0d3ff74ea8f27ca487134684cae6d 100644 |
--- a/src/string-stream.h |
+++ b/src/string-stream.h |
@@ -187,6 +187,31 @@ class StringStream { |
}; |
+// Utility class to print a list of items to a stream, divided by a separator. |
+class SimpleListPrinter { |
+ public: |
+ explicit SimpleListPrinter(StringStream* stream, char separator = ',') { |
+ separator_ = separator; |
+ stream_ = stream; |
+ first_ = true; |
+ } |
+ |
+ void Add(const char* str) { |
+ if (first_) { |
+ first_ = false; |
+ } else { |
+ stream_->Put(separator_); |
+ } |
+ stream_->Add(str); |
+ } |
+ |
+ private: |
+ bool first_; |
+ char separator_; |
+ StringStream* stream_; |
+}; |
+ |
+ |
} } // namespace v8::internal |
#endif // V8_STRING_STREAM_H_ |