The scope of a function in the RHS of a let expression/statement includes the LHS of it

RESOLVED FIXED

Status

()

Core
JavaScript Engine
RESOLVED FIXED
9 years ago
5 years ago

People

(Reporter: nanto_vi (TOYAMA Nao), Unassigned)

Tracking

Trunk
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

9 years ago
From bug 462385 comment 3
> var o = { x: "out of let" };
> let (o = { y: function () { return o.x; }, x: "rhs of let" }) alert(o.y());
> 
> This outputs "rhs of let".

More simply,

  var x = 42;
  let (x = (function () { return x; })()) print(x);

Expects 42 to be output but actually gets undefined.

Confirmed in Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2a1pre) Gecko/20090626 Minefield/3.6a1pre
Version: unspecified → Trunk

Updated

5 years ago
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.