Commit 7245dabd authored by littledan's avatar littledan Committed by Commit bot

Unship ES2015 for-in initializer restrictions

We now have data that 0.011% of websites use the pattern
  for (var i = 0 in j) { ... }
This pattern was banned by ES2015, with the idea to revisit if
it presents a web compatibility problem. Informally, after
the May 2016 TC39 meeting, the new data was discussed, and there
was interest in reversing the decision. Although the specification
is not yet updated, it seems likely to come soon.

This patch turns off the flag which bans that construct, reenabling
it. The change should prevent websites from breaking.

BUG=v8:4942

Review-Url: https://codereview.chromium.org/2011223003
Cr-Commit-Position: refs/heads/master@{#36562}
parent 9778f2ef
......@@ -205,6 +205,7 @@ DEFINE_IMPLICATION(es_staging, move_object_start)
V(harmony_restrictive_generators, \
"harmony restrictions on generator declarations") \
V(harmony_regexp_property, "harmony unicode regexp property classes") \
V(harmony_for_in, "harmony for-in syntax") \
V(harmony_async_await, "harmony async-await")
// Features that are complete (but still behind --harmony/es-staging flag).
......@@ -230,7 +231,6 @@ DEFINE_IMPLICATION(es_staging, move_object_start)
V(harmony_array_prototype_values, "harmony Array.prototype.values") \
V(harmony_function_name, "harmony Function name inference") \
V(harmony_instanceof, "harmony instanceof support") \
V(harmony_for_in, "harmony for-in syntax") \
V(harmony_iterator_close, "harmony iterator finalization") \
V(harmony_unicode_regexps, "harmony unicode regexps") \
V(harmony_regexp_exec, "harmony RegExp exec override behavior") \
......
......@@ -466,8 +466,8 @@ PASS Invalid: "for (var a = -6, b in b) break"
PASS Invalid: "function f() { for (var a = -6, b in b) break }"
PASS Invalid: "for (var a, b = 8 in b) break"
PASS Invalid: "function f() { for (var a, b = 8 in b) break }"
FAIL Valid: "for (var a = (b in c) in d) break" should NOT throw
FAIL Valid: "function f() { for (var a = (b in c) in d) break }" should NOT throw
PASS Valid: "for (var a = (b in c) in d) break"
PASS Valid: "function f() { for (var a = (b in c) in d) break }"
PASS Invalid: "for (var a = (b in c in d) break"
PASS Invalid: "function f() { for (var a = (b in c in d) break }"
PASS Invalid: "for (var (a) in b) { }"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment