Commit 572c7527 authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[scanner] Explicitly add one-byte characters to a one-byte literal buffer when...

[scanner] Explicitly add one-byte characters to a one-byte literal buffer when scanning ascii identifiers

Change-Id: Ia8337506d9f442d6887b6fa3c2ed17210ffd3c28
Reviewed-on: https://chromium-review.googlesource.com/1172789Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55096}
parent 6772dc5c
...@@ -1592,13 +1592,15 @@ Token::Value Scanner::ScanIdentifierOrKeywordInner(LiteralScope* literal) { ...@@ -1592,13 +1592,15 @@ Token::Value Scanner::ScanIdentifierOrKeywordInner(LiteralScope* literal) {
bool escaped = false; bool escaped = false;
if (IsInRange(c0_, 'a', 'z') || c0_ == '_') { if (IsInRange(c0_, 'a', 'z') || c0_ == '_') {
do { do {
AddLiteralCharAdvance(); AddLiteralChar(static_cast<char>(c0_));
Advance();
} while (IsInRange(c0_, 'a', 'z') || c0_ == '_'); } while (IsInRange(c0_, 'a', 'z') || c0_ == '_');
if (IsDecimalDigit(c0_) || IsInRange(c0_, 'A', 'Z') || c0_ == '$') { if (IsDecimalDigit(c0_) || IsInRange(c0_, 'A', 'Z') || c0_ == '$') {
// Identifier starting with lowercase or _. // Identifier starting with lowercase or _.
do { do {
AddLiteralCharAdvance(); AddLiteralChar(static_cast<char>(c0_));
Advance();
} while (IsAsciiIdentifier(c0_)); } while (IsAsciiIdentifier(c0_));
if (c0_ <= kMaxAscii && c0_ != '\\') { if (c0_ <= kMaxAscii && c0_ != '\\') {
...@@ -1618,7 +1620,8 @@ Token::Value Scanner::ScanIdentifierOrKeywordInner(LiteralScope* literal) { ...@@ -1618,7 +1620,8 @@ Token::Value Scanner::ScanIdentifierOrKeywordInner(LiteralScope* literal) {
} }
} else if (IsInRange(c0_, 'A', 'Z') || c0_ == '$') { } else if (IsInRange(c0_, 'A', 'Z') || c0_ == '$') {
do { do {
AddLiteralCharAdvance(); AddLiteralChar(static_cast<char>(c0_));
Advance();
} while (IsAsciiIdentifier(c0_)); } while (IsAsciiIdentifier(c0_));
if (c0_ <= kMaxAscii && c0_ != '\\') { if (c0_ <= kMaxAscii && c0_ != '\\') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment