Closed Bug 568708 Opened 14 years ago Closed 14 years ago

Bogus ReferenceError with lambda outliving let-block

Categories

(Core :: JavaScript Engine, defect)

Other Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 590006

People

(Reporter: jorendorff, Unassigned)

Details

var f;
for (var i = 0; i < 9; i++) {
    let k = i;
    f = function() { return k; };
}
assertEq(f(), 8);


ReferenceError: k is not defined

Here f is not a flat closure (for bogus reasons, I think) but it should work anyway. f is just a regular old function, and the opcode that throws is a JSOP_NAME which should find k on the scope chain.

Blake had me look, and we think the bug is that TR::scopeChain() never clones Block objects:

JS_REQUIRES_STACK LIns*
TraceRecorder::scopeChain()
{
    return cx->fp->callee()
           ? get(&cx->fp->scopeChainVal)
           : entryScopeChain();
}
See bug 545759 -- is this (current) bug a dup?

/be
Nominating. This bug trips assertions in my brain.
blocking2.0: --- → ?
Well, hang on: the test case passes now. Sorry for the noise. Trying now to find out if anything is really busted here.
blocking2.0: ? → ---
Fix identified!
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.