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

Unified Diff: src/parsing/parser.cc

Issue 1911963003: Add flag for disallowing for-in initializers (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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/flag-definitions.h ('k') | test/mjsunit/harmony/for-in.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser.cc
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
index e2e8f92ad9f922a5838b96ddea114da2c24e5c79..452b0ef30029a5bfc0665b99f2d800518b2a3030 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -3500,6 +3500,14 @@ Statement* Parser::ParseForStatement(ZoneList<const AstRawString*>* labels,
if (!IsLexicalVariableMode(parsing_result.descriptor.mode) &&
decl.pattern->IsVariableProxy() && decl.initializer != nullptr) {
++use_counts_[v8::Isolate::kForInInitializer];
+ if (FLAG_harmony_for_in) {
nickie 2016/04/22 11:22:56 Shouldn't a similar thing be added to the preparse
rossberg 2016/04/22 11:34:50 Yes, normally it should. However, we'd lose use co
adamk 2016/04/22 17:28:18 This inconsistency seems like it'll cause us some
+ ParserTraits::ReportMessageAt(
+ parsing_result.first_initializer_loc,
+ MessageTemplate::kForInOfLoopInitializer,
+ ForEachStatement::VisitModeString(mode));
+ *ok = false;
+ return nullptr;
+ }
const AstRawString* name =
decl.pattern->AsVariableProxy()->raw_name();
VariableProxy* single_var = scope_->NewUnresolved(
« no previous file with comments | « src/flag-definitions.h ('k') | test/mjsunit/harmony/for-in.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698