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

Side by Side Diff: src/scanner.cc

Issue 652743009: Classes: static should still be treated as a strict reserved word (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Use let and not eval. Add tests that covers this too Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Features shared by parsing and pre-parsing scanners. 5 // Features shared by parsing and pre-parsing scanners.
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 10
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 } 1011 }
1012 KEYWORDS(KEYWORD_GROUP_CASE, KEYWORD) 1012 KEYWORDS(KEYWORD_GROUP_CASE, KEYWORD)
1013 } 1013 }
1014 return Token::IDENTIFIER; 1014 return Token::IDENTIFIER;
1015 } 1015 }
1016 1016
1017 1017
1018 bool Scanner::IdentifierIsFutureStrictReserved( 1018 bool Scanner::IdentifierIsFutureStrictReserved(
1019 const AstRawString* string) const { 1019 const AstRawString* string) const {
1020 // Keywords are always 1-byte strings. 1020 // Keywords are always 1-byte strings.
1021 return string->is_one_byte() && 1021 if (!string->is_one_byte()) return false;
1022 Token::FUTURE_STRICT_RESERVED_WORD == 1022 if (string->IsOneByteEqualTo("let") || string->IsOneByteEqualTo("static") ||
1023 KeywordOrIdentifierToken(string->raw_data(), string->length(), 1023 string->IsOneByteEqualTo("yield")) {
1024 harmony_scoping_, harmony_modules_, 1024 return true;
1025 harmony_classes_); 1025 }
1026 return Token::FUTURE_STRICT_RESERVED_WORD ==
1027 KeywordOrIdentifierToken(string->raw_data(), string->length(),
1028 harmony_scoping_, harmony_modules_,
1029 harmony_classes_);
1026 } 1030 }
1027 1031
1028 1032
1029 Token::Value Scanner::ScanIdentifierOrKeyword() { 1033 Token::Value Scanner::ScanIdentifierOrKeyword() {
1030 DCHECK(unicode_cache_->IsIdentifierStart(c0_)); 1034 DCHECK(unicode_cache_->IsIdentifierStart(c0_));
1031 LiteralScope literal(this); 1035 LiteralScope literal(this);
1032 // Scan identifier start character. 1036 // Scan identifier start character.
1033 if (c0_ == '\\') { 1037 if (c0_ == '\\') {
1034 uc32 c = ScanIdentifierUnicodeEscape(); 1038 uc32 c = ScanIdentifierUnicodeEscape();
1035 // Only allow legal identifier start characters. 1039 // Only allow legal identifier start characters.
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 } 1368 }
1365 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); 1369 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u));
1366 } 1370 }
1367 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); 1371 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f));
1368 1372
1369 backing_store_.AddBlock(bytes); 1373 backing_store_.AddBlock(bytes);
1370 return backing_store_.EndSequence().start(); 1374 return backing_store_.EndSequence().start();
1371 } 1375 }
1372 1376
1373 } } // namespace v8::internal 1377 } } // namespace v8::internal
OLDNEW
« src/preparser.h ('K') | « src/preparser.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698