Index: src/scanner.cc |
diff --git a/src/scanner.cc b/src/scanner.cc |
index c6c0a8d6a23448b7be244224ec48bc5b37b16cee..0a3d69dea97ea28c3903b9e4f7aec2241fb5dc41 100644 |
--- a/src/scanner.cc |
+++ b/src/scanner.cc |
@@ -1266,7 +1266,7 @@ Token::Value Scanner::ScanIdentifierOrKeyword() { |
return Token::ILLEGAL; |
} |
AddLiteralChar(c); |
- return ScanIdentifierSuffix(&literal); |
+ return ScanIdentifierOrKeywordSuffix(&literal); |
} else { |
uc32 first_char = c0_; |
Advance(); |
@@ -1281,8 +1281,8 @@ Token::Value Scanner::ScanIdentifierOrKeyword() { |
AddLiteralChar(next_char); |
continue; |
} |
- // Fallthrough if no longer able to complete keyword. |
- return ScanIdentifierSuffix(&literal); |
+ // Fallthrough if a unicode escape is found. |
+ return ScanIdentifierOrKeywordSuffix(&literal); |
} |
literal.Complete(); |
@@ -1295,7 +1295,7 @@ Token::Value Scanner::ScanIdentifierOrKeyword() { |
} |
-Token::Value Scanner::ScanIdentifierSuffix(LiteralScope* literal) { |
+Token::Value Scanner::ScanIdentifierOrKeywordSuffix(LiteralScope* literal) { |
// Scan the rest of the identifier characters. |
while (c0_ >= 0 && unicode_cache_->IsIdentifierPart(c0_)) { |
if (c0_ == '\\') { |
@@ -1314,6 +1314,11 @@ Token::Value Scanner::ScanIdentifierSuffix(LiteralScope* literal) { |
} |
literal->Complete(); |
+ if (next_.literal_chars->is_one_byte()) { |
+ Vector<const uint8_t> chars = next_.literal_chars->one_byte_literal(); |
+ return KeywordOrIdentifierToken(chars.start(), chars.length()); |
+ } |
+ |
return Token::IDENTIFIER; |
} |