Index: src/parsing/scanner.h |
diff --git a/src/parsing/scanner.h b/src/parsing/scanner.h |
index 22c504c98ea206b760d84ae76b8bb85b5ddfe81c..0bb18679c525aea7154dbbb687494e366b923511 100644 |
--- a/src/parsing/scanner.h |
+++ b/src/parsing/scanner.h |
@@ -225,8 +225,14 @@ class LiteralBuffer { |
} else { |
is_one_byte_ = other->is_one_byte_; |
position_ = other->position_; |
- backing_store_.Dispose(); |
- backing_store_ = other->backing_store_.Clone(); |
+ if (position_ < backing_store_.length()) { |
+ std::copy(other->backing_store_.begin(), |
+ other->backing_store_.begin() + position_, |
+ backing_store_.begin()); |
+ } else { |
+ backing_store_.Dispose(); |
+ backing_store_ = other->backing_store_.Clone(); |
+ } |
} |
} |