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

Unified Diff: src/preparser.h

Issue 1371263003: Prohibit let in lexical bindings (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: remove messages.js test Created 5 years, 2 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') | src/preparser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/preparser.h
diff --git a/src/preparser.h b/src/preparser.h
index 45a7721fdfbec2daf76078c2bf2da1cbe2976663..b86dc9bb3688a0df9e3ab84dcba99306e867c1e6 100644
--- a/src/preparser.h
+++ b/src/preparser.h
@@ -618,6 +618,13 @@ class ParserBase : public Traits {
}
}
+ void ValidateLetPattern(const ExpressionClassifier* classifier, bool* ok) {
+ if (!classifier->is_valid_let_pattern()) {
+ ReportClassifierError(classifier->let_pattern_error());
+ *ok = false;
+ }
+ }
+
void ExpressionUnexpectedToken(ExpressionClassifier* classifier) {
MessageTemplate::Template message = MessageTemplate::kUnexpectedToken;
const char* arg;
@@ -2092,6 +2099,10 @@ ParserBase<Traits>::ParseAndClassifyIdentifier(ExpressionClassifier* classifier,
(next == Token::YIELD && !is_generator()))) {
classifier->RecordStrictModeFormalParameterError(
scanner()->location(), MessageTemplate::kUnexpectedStrictReserved);
+ if (next == Token::LET) {
+ classifier->RecordLetPatternError(scanner()->location(),
+ MessageTemplate::kLetInLexicalBinding);
+ }
return this->GetSymbol(scanner());
} else {
this->ReportUnexpectedToken(next);
« no previous file with comments | « src/parser.cc ('k') | src/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698