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

Unified Diff: src/preparser.cc

Issue 7061008: Create template system for strict-mode tests. (Closed)
Patch Set: Remove debug print. Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « preparser/preparser-process.cc ('k') | test/preparser/preparser.expectation » ('j') | 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 3c48d14bab72835ac7ffefb2c02afb6801e0b162..4ee9bf24235824a64cfe31b7943cb76ef96518c6 100644
--- a/src/preparser.cc
+++ b/src/preparser.cc
@@ -309,6 +309,13 @@ PreParser::Statement PreParser::ParseVariableDeclarations(bool accept_IN,
if (peek() == i::Token::VAR) {
Consume(i::Token::VAR);
} else if (peek() == i::Token::CONST) {
+ if (strict_mode()) {
+ i::Scanner::Location location = scanner_->peek_location();
+ ReportMessageAt(location.beg_pos, location.end_pos,
+ "strict_const", NULL);
+ *ok = false;
+ return Statement::Default();
+ }
Consume(i::Token::CONST);
} else {
*ok = false;
@@ -348,9 +355,11 @@ PreParser::Statement PreParser::ParseExpressionOrLabelledStatement(bool* ok) {
Expression expr = ParseExpression(true, CHECK_OK);
if (peek() == i::Token::COLON && expr.IsRawIdentifier()) {
- Consume(i::Token::COLON);
- ParseStatement(ok);
- return Statement::Default();
+ if (!strict_mode() || !expr.AsIdentifier().IsFutureReserved()) {
+ Consume(i::Token::COLON);
+ ParseStatement(ok);
+ return Statement::Default();
+ }
}
// Parsed expression statement.
ExpectSemicolon(CHECK_OK);
« no previous file with comments | « preparser/preparser-process.cc ('k') | test/preparser/preparser.expectation » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698