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

Side by Side Diff: src/parsing/parser-base.h

Issue 1891453005: [parser] Relex restriction on reserved words (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Restoring 'let let' case (with explanation) Created 4 years, 7 months 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
« no previous file with comments | « no previous file | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #ifndef V8_PARSING_PARSER_BASE_H 5 #ifndef V8_PARSING_PARSER_BASE_H
6 #define V8_PARSING_PARSER_BASE_H 6 #define V8_PARSING_PARSER_BASE_H
7 7
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/bailout-reason.h" 9 #include "src/bailout-reason.h"
10 #include "src/hashmap.h" 10 #include "src/hashmap.h"
(...skipping 3225 matching lines...) Expand 10 before | Expand all | Expand 10 after
3236 3236
3237 template <class Traits> 3237 template <class Traits>
3238 bool ParserBase<Traits>::IsNextLetKeyword() { 3238 bool ParserBase<Traits>::IsNextLetKeyword() {
3239 DCHECK(peek() == Token::LET); 3239 DCHECK(peek() == Token::LET);
3240 Token::Value next_next = PeekAhead(); 3240 Token::Value next_next = PeekAhead();
3241 switch (next_next) { 3241 switch (next_next) {
3242 case Token::LBRACE: 3242 case Token::LBRACE:
3243 case Token::LBRACK: 3243 case Token::LBRACK:
3244 case Token::IDENTIFIER: 3244 case Token::IDENTIFIER:
3245 case Token::STATIC: 3245 case Token::STATIC:
3246 case Token::LET: // Yes, you can do let let = ... in sloppy mode 3246 case Token::LET: // `let let;` is disallowed by static semantics, but the
3247 // token must be first interpreted as a keyword in order
3248 // for those semantics to apply. This ensures that ASI is
3249 // not honored when a LineTerminator separates the
3250 // tokens.
3247 case Token::YIELD: 3251 case Token::YIELD:
3248 case Token::AWAIT: 3252 case Token::AWAIT:
3249 case Token::ASYNC: 3253 case Token::ASYNC:
3250 return true; 3254 return true;
3255 case Token::FUTURE_STRICT_RESERVED_WORD:
3256 return is_sloppy(language_mode());
3251 default: 3257 default:
3252 return false; 3258 return false;
3253 } 3259 }
3254 } 3260 }
3255 3261
3256 template <class Traits> 3262 template <class Traits>
3257 typename ParserBase<Traits>::ExpressionT 3263 typename ParserBase<Traits>::ExpressionT
3258 ParserBase<Traits>::ParseArrowFunctionLiteral( 3264 ParserBase<Traits>::ParseArrowFunctionLiteral(
3259 bool accept_IN, const FormalParametersT& formal_parameters, bool is_async, 3265 bool accept_IN, const FormalParametersT& formal_parameters, bool is_async,
3260 const ExpressionClassifier& formals_classifier, bool* ok) { 3266 const ExpressionClassifier& formals_classifier, bool* ok) {
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
3587 has_seen_constructor_ = true; 3593 has_seen_constructor_ = true;
3588 return; 3594 return;
3589 } 3595 }
3590 } 3596 }
3591 3597
3592 3598
3593 } // namespace internal 3599 } // namespace internal
3594 } // namespace v8 3600 } // namespace v8
3595 3601
3596 #endif // V8_PARSING_PARSER_BASE_H 3602 #endif // V8_PARSING_PARSER_BASE_H
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698