Index: src/parsing/scanner.cc |
diff --git a/src/parsing/scanner.cc b/src/parsing/scanner.cc |
index f9438ca11da40ace4cca7b22bee8e96c90da6df8..06ead2e827a4975369988448fdff459c17856aff 100644 |
--- a/src/parsing/scanner.cc |
+++ b/src/parsing/scanner.cc |
@@ -1598,14 +1598,9 @@ void Scanner::ResetToBookmark() { |
source_->ResetToBookmark(); |
c0_ = bookmark_c0_; |
- StartLiteral(); |
- StartRawLiteral(); |
- CopyTokenDesc(&next_, &bookmark_current_); |
+ CopyToNextTokenDesc(&bookmark_current_); |
current_ = next_; |
- StartLiteral(); |
- StartRawLiteral(); |
- CopyTokenDesc(&next_, &bookmark_next_); |
- |
+ CopyToNextTokenDesc(&bookmark_next_); |
bookmark_c0_ = kBookmarkWasApplied; |
} |
@@ -1620,6 +1615,13 @@ bool Scanner::BookmarkHasBeenReset() { |
void Scanner::DropBookmark() { bookmark_c0_ = kNoBookmark; } |
+void Scanner::CopyToNextTokenDesc(TokenDesc* from) { |
+ StartLiteral(); |
+ StartRawLiteral(); |
+ CopyTokenDesc(&next_, from); |
+ if (next_.literal_chars->length() == 0) next_.literal_chars = nullptr; |
+ if (next_.raw_literal_chars->length() == 0) next_.raw_literal_chars = nullptr; |
+} |
void Scanner::CopyTokenDesc(TokenDesc* to, TokenDesc* from) { |
DCHECK_NOT_NULL(to); |