Chromium Code Reviews| Index: src/parsing/scanner.h |
| diff --git a/src/parsing/scanner.h b/src/parsing/scanner.h |
| index 0acc7ab019a1c7e033ec9160d905990b4419b1bf..bbcd037a3f82c6b8f71c30f1e0e6844f8d8e3259 100644 |
| --- a/src/parsing/scanner.h |
| +++ b/src/parsing/scanner.h |
| @@ -158,7 +158,15 @@ class LiteralBuffer { |
| ~LiteralBuffer() { backing_store_.Dispose(); } |
| - INLINE(void AddChar(uint32_t code_unit)) { |
| + INLINE(void AddChar(char code_unit)) { |
| + if (position_ >= backing_store_.length()) ExpandBuffer(); |
| + DCHECK(is_one_byte_); |
|
vogelheim
2016/06/09 12:05:15
Maybe also dcheck whether code_unit is actually as
|
| + backing_store_[position_] = static_cast<byte>(code_unit); |
| + position_ += kOneByteSize; |
| + return; |
| + } |
| + |
| + INLINE(void AddChar(uc32 code_unit)) { |
| if (position_ >= backing_store_.length()) ExpandBuffer(); |
| if (is_one_byte_) { |
| if (code_unit <= unibrow::Latin1::kMaxChar) { |
| @@ -557,6 +565,11 @@ class Scanner { |
| next_.literal_chars->AddChar(c); |
| } |
| + INLINE(void AddLiteralChar(char c)) { |
| + DCHECK_NOT_NULL(next_.literal_chars); |
| + next_.literal_chars->AddChar(c); |
| + } |
| + |
| INLINE(void AddRawLiteralChar(uc32 c)) { |
| DCHECK_NOT_NULL(next_.raw_literal_chars); |
| next_.raw_literal_chars->AddChar(c); |