Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Unified Diff: src/scanner.cc

Issue 1429983002: [es6] early error when Identifier is an escaped reserved word (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/scanner.cc
diff --git a/src/scanner.cc b/src/scanner.cc
index 04712e9f32a8ea529cc3b02ff6210e4e0d2b6e91..bf03700a23712c4b7e66fd2b30ff634740940806 100644
--- a/src/scanner.cc
+++ b/src/scanner.cc
@@ -1499,6 +1499,30 @@ void Scanner::CopyTokenDesc(TokenDesc* to, TokenDesc* from) {
}
+bool Scanner::IsNextEscapedReservedWord(LanguageMode language_mode,
+ bool is_generator, bool sloppy_let) {
+ if (next_.token == Token::IDENTIFIER) {
+ if (next_.literal_chars && next_.literal_chars->is_one_byte() &&
adamk 2015/11/03 23:00:57 Please join this if() into the one on the line abo
caitp (gmail) 2015/11/04 04:49:24 Done.
+ next_literal_contains_escapes(next_)) {
adamk 2015/11/03 23:00:57 This won't compile, I'm guessing you can drop next
caitp (gmail) 2015/11/04 04:49:24 It was a last minute fixup, which failed because o
+ Vector<const uint8_t> chars = next_.literal_chars->one_byte_literal();
caitp (gmail) 2015/11/03 17:19:13 I don't think this allocates a copy of the string,
adamk 2015/11/03 23:00:57 You're correct that there's no copy here.
caitp (gmail) 2015/11/04 04:49:24 Acknowledged.
+ switch (KeywordOrIdentifierToken(chars.start(), chars.length())) {
+ case Token::IDENTIFIER:
+ return false;
+ case Token::FUTURE_STRICT_RESERVED_WORD:
+ return is_strict(language_mode);
+ case Token::YIELD:
+ return is_generator;
+ case Token::LET:
+ return sloppy_let || is_strict(language_mode);
adamk 2015/11/03 23:00:57 My reading of the spec you pointed to is that LET
caitp (gmail) 2015/11/04 04:49:24 It was meant for the block underneath, but I guess
+ default:
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+
int DuplicateFinder::AddOneByteSymbol(Vector<const uint8_t> key, int value) {
return AddSymbol(key, true, value);
}

Powered by Google App Engine
This is Rietveld 408576698