Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index 402010e91a7d8058eb9d45971cdcc2e27f60dbb3..88ced6c4438e9bc587f5c262fdfc872fe342405d 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -7521,6 +7521,49 @@ Object* JSMapIterator::CurrentValue() { |
} |
+class String::SubStringRange::iterator FINAL { |
+ public: |
+ typedef std::forward_iterator_tag iterator_category; |
+ typedef int difference_type; |
+ typedef uc16 value_type; |
+ typedef uc16* pointer; |
+ typedef uc16& reference; |
+ |
+ iterator(const iterator& other) |
+ : content_(other.content_), offset_(other.offset_) {} |
+ |
+ uc16 operator*() { return content_.Get(offset_); } |
+ bool operator==(const iterator& other) const { |
+ return content_.UsesSameString(other.content_) && offset_ == other.offset_; |
+ } |
+ bool operator!=(const iterator& other) const { |
+ return !content_.UsesSameString(other.content_) || offset_ != other.offset_; |
+ } |
+ iterator& operator++() { |
+ ++offset_; |
+ return *this; |
+ } |
+ iterator operator++(int); |
+ |
+ private: |
+ friend class String; |
+ iterator(String* from, int offset) |
+ : content_(from->GetFlatContent()), offset_(offset) {} |
+ String::FlatContent content_; |
+ int offset_; |
+}; |
+ |
+ |
+String::SubStringRange::iterator String::SubStringRange::begin() { |
+ return String::SubStringRange::iterator(string_, first_); |
+} |
+ |
+ |
+String::SubStringRange::iterator String::SubStringRange::end() { |
+ return String::SubStringRange::iterator(string_, first_ + length_); |
+} |
+ |
+ |
#undef TYPE_CHECKER |
#undef CAST_ACCESSOR |
#undef INT_ACCESSORS |