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

Unified Diff: src/scanner.h

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.h
diff --git a/src/scanner.h b/src/scanner.h
index 6d0d4dc8eddb52022f67cb1cdb01273695666373..3e5e682c089c8c7f3631b9b2003c6827b7663455 100644
--- a/src/scanner.h
+++ b/src/scanner.h
@@ -373,13 +373,10 @@ class Scanner {
Location peek_location() const { return next_.location; }
bool literal_contains_escapes() const {
- Location location = current_.location;
- int source_length = (location.end_pos - location.beg_pos);
- if (current_.token == Token::STRING) {
- // Subtract delimiters.
- source_length -= 2;
- }
- return current_.literal_chars->length() != source_length;
+ return literal_contains_escapes(current_);
+ }
+ bool next_literal_contains_escapes() const {
+ return literal_contains_escapes(next_);
}
bool is_literal_contextual_keyword(Vector<const char> keyword) {
DCHECK_NOT_NULL(current_.literal_chars);
@@ -394,6 +391,9 @@ class Scanner {
const AstRawString* NextSymbol(AstValueFactory* ast_value_factory);
const AstRawString* CurrentRawSymbol(AstValueFactory* ast_value_factory);
+ bool IsNextEscapedReservedWord(LanguageMode language_mode, bool is_generator,
+ bool allow_sloppy_let);
+
double DoubleValue();
bool ContainsDot();
bool LiteralMatches(const char* data, int length, bool allow_escapes = true) {
@@ -689,6 +689,16 @@ class Scanner {
return static_cast<int>(source_->pos()) - kCharacterLookaheadBufferSize;
}
+ bool literal_contains_escapes(const TokenDesc& token) const {
adamk 2015/11/03 23:00:57 This could be static (and thus not const). And Cam
caitp (gmail) 2015/11/04 04:49:24 Done.
+ Location location = token.location;
+ int source_length = (location.end_pos - location.beg_pos);
+ if (token.token == Token::STRING) {
+ // Subtract delimiters.
+ source_length -= 2;
+ }
+ return token.literal_chars->length() != source_length;
+ }
+
UnicodeCache* unicode_cache_;
// Buffers collecting literal strings, numbers, etc.

Powered by Google App Engine
This is Rietveld 408576698