Closed Bug 1135167 Opened 5 years ago Closed 5 years ago

Invalid scoping in «for (let i in/of expr)» blocks.

Categories

(Core :: JavaScript Engine, defect)

38 Branch
x86_64
Linux
defect
Not set

Tracking

()

RESOLVED DUPLICATE of bug 1069480

People

(Reporter: ChALkeRx, Unassigned)

References

Details

Attachments

(1 file)

Attached file #jsapi irc log
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.111 Safari/537.36

Steps to reproduce:

1) var i = [1, 2, 3]; for (let i of i) console.log(i);
2) var i = [1, 2, 3]; for (let i in i) console.log(i);
3) for (let i in/of a[i]/f[i]), anything where «expr» depends on «i».


Actual results:

1) 1 2 3
2) 0 1 2
3) When evaluting «expr», «i» is taken from outside of the scope.


Expected results:

1) Exception
2) Exception
3) Exception

See https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-forin-div-ofheadevaluation-tdznames-expr-iterationkind-labelset
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
Blocks: 449811
Validated only in nightly-37, after updating to nightly-38 firefox somewhy fails to launch, so I can't check 38 now.
Summary: Invalid scoping in «for var i in/of expr» blocks. → Invalid scoping in «for (let i in/of expr)» blocks.
Version: 37 Branch → 38 Branch
Just verified in 38.0a1 (2015-02-20).
Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1069480
You need to log in before you can comment on or make changes to this bug.