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

Unified Diff: src/parsing/parser-base.h

Issue 2185223002: Fix not throwing error when redefine eval or arguments in strict mode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: add test Created 4 years, 5 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/mjsunit/strict-mode-eval.js » ('j') | test/mjsunit/strict-mode-eval.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser-base.h
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h
index 000b606a9549570b50ca9429633a5d88e6dbbf3f..e42566719daec863ad54678ad64c9042b1861520 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -1970,7 +1970,7 @@ ParserBase<Traits>::ParsePropertyDefinition(
CheckDestructuringElement(lhs, classifier, next_beg_pos, next_end_pos);
ExpressionT value;
- if (peek() == Token::ASSIGN) {
+ if (IsValidReferenceExpression(lhs) && peek() == Token::ASSIGN) {
Dan Ehrenberg 2016/07/28 00:13:38 Does the insertion of IsValidReferenceExpression(l
Consume(Token::ASSIGN);
ExpressionClassifier rhs_classifier(this);
ExpressionT rhs = this->ParseAssignmentExpression(
@@ -1987,6 +1987,11 @@ ParserBase<Traits>::ParsePropertyDefinition(
Traits::SetFunctionNameFromIdentifierRef(rhs, lhs);
} else {
+ if (this->IsIdentifier(lhs) && is_strict(language_mode()) &&
+ this->IsEvalOrArguments(this->AsIdentifier(lhs))) {
+ ReportMessageAt(Scanner::Location(next_beg_pos, next_end_pos),
adamk 2016/07/28 18:46:55 I think you should be able to detect this when par
lpy 2016/08/05 22:15:41 Done.
+ MessageTemplate::kStrictEvalArguments, kSyntaxError);
+ }
value = lhs;
}
« no previous file with comments | « no previous file | test/mjsunit/strict-mode-eval.js » ('j') | test/mjsunit/strict-mode-eval.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698