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

Unified Diff: src/preparser.cc

Issue 1356783002: Stop emitting kSloppyLexical errors when --harmony-sloppy-let is enabled (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parser.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/preparser.cc
diff --git a/src/preparser.cc b/src/preparser.cc
index f7f8b2b8900412a1dad8279fbb5c368931dd30bb..44ba38b0b3e1239a137d3a59e15d865e33a283c8 100644
--- a/src/preparser.cc
+++ b/src/preparser.cc
@@ -700,8 +700,9 @@ PreParser::Statement PreParser::ParseExpressionOrLabelledStatement(bool* ok) {
}
// Parsed expression statement.
// Detect attempts at 'let' declarations in sloppy mode.
- if (peek() == Token::IDENTIFIER && is_sloppy(language_mode()) &&
- expr.IsIdentifier() && expr.AsIdentifier().IsLet()) {
+ if (!allow_harmony_sloppy_let() && peek() == Token::IDENTIFIER &&
+ is_sloppy(language_mode()) && expr.IsIdentifier() &&
+ expr.AsIdentifier().IsLet()) {
ReportMessage(MessageTemplate::kSloppyLexical, NULL);
*ok = false;
return Statement::Default();
@@ -960,8 +961,8 @@ PreParser::Statement PreParser::ParseForStatement(bool* ok) {
// Parsed initializer at this point.
// Detect attempts at 'let' declarations in sloppy mode.
- if (peek() == Token::IDENTIFIER && is_sloppy(language_mode()) &&
- is_let_identifier_expression) {
+ if (!allow_harmony_sloppy_let() && peek() == Token::IDENTIFIER &&
+ is_sloppy(language_mode()) && is_let_identifier_expression) {
ReportMessage(MessageTemplate::kSloppyLexical, NULL);
*ok = false;
return Statement::Default();
« no previous file with comments | « src/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698