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

Unified Diff: src/preparser.cc

Issue 7987002: Disallow strict mode FutureReservedWords as break/continue labels in strict mode (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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 | « no previous file | test/preparser/strict-identifiers.pyt » ('j') | test/preparser/strict-identifiers.pyt » ('J')
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 b36e5b1d3ac50d62fdae3bc71a81853b94435ae3..c4d2cfe13a2158effbafea10c7a7426b81344859 100644
--- a/src/preparser.cc
+++ b/src/preparser.cc
@@ -390,8 +390,9 @@ PreParser::Statement PreParser::ParseExpressionOrLabelledStatement(bool* ok) {
Expression expr = ParseExpression(true, CHECK_OK);
if (expr.IsRawIdentifier()) {
- if (peek() == i::Token::COLON &&
- (!strict_mode() || !expr.AsIdentifier().IsFutureReserved())) {
+ ASSERT(!expr.AsIdentifier().IsFutureReserved());
+ ASSERT(!strict_mode() || !expr.AsIdentifier().IsFutureStrictReserved());
+ if (peek() == i::Token::COLON) {
Consume(i::Token::COLON);
return ParseStatement(ok);
}
@@ -1436,9 +1437,16 @@ PreParser::Identifier PreParser::ParseIdentifier(bool* ok) {
ReportMessageAt(location.beg_pos, location.end_pos,
"reserved_word", NULL);
*ok = false;
+ return GetIdentifierSymbol();
}
- // FALLTHROUGH
case i::Token::FUTURE_STRICT_RESERVED_WORD:
+ if (strict_mode()) {
+ i::Scanner::Location location = scanner_->location();
+ ReportMessageAt(location.beg_pos, location.end_pos,
+ "strict_reserved_word", NULL);
+ *ok = false;
+ }
+ // FALLTHROUGH
case i::Token::IDENTIFIER:
return GetIdentifierSymbol();
default:
« no previous file with comments | « no previous file | test/preparser/strict-identifiers.pyt » ('j') | test/preparser/strict-identifiers.pyt » ('J')

Powered by Google App Engine
This is Rietveld 408576698