Closed
Bug 744501
Opened 14 years ago
Closed 14 years ago
Variables declared with 'var [...]' have wrong scopes.
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
People
(Reporter: spammed.user, Assigned: luke)
References
(
URL
)
Details
Run the following code:
function x(){var a=1;x=function(){return a;};return a;}
alert(x());
alert(x());
It alerts '1' twice, as it should. However,
function x(){var [a]=[1];x=function(){return a;};return a;}
alert(x());
alert(x());
alerts '1' and then 'undefined'. Also,
function x(){var a=1;x=function(){return a;};return a;}
alert(x());
alert(x());
function x(){var [a]=[1];x=function(){return a;};return a;}
alert(x());
alert(x());
alerts '1', 'undefined', 'undefined', 'undefined', whereas
function x(){var [a]=[1];x=function(){return a;};return a;}
alert(x());
alert(x());
function x(){var a=1;x=function(){return a;};return a;}
alert(x());
alert(x());
works properly – it alerts 4 '1's.
| Reporter | ||
Updated•14 years ago
|
Summary: Variables declared with 'var [...]' have improper scopes. → Variables declared with 'var [...]' have wrong scopes.
| Assignee | ||
Updated•14 years ago
|
| Assignee | ||
Comment 1•14 years ago
|
||
Oops, repros on trunk, not caused by 740259.
No longer blocks: 740259
| Assignee | ||
Comment 2•14 years ago
|
||
Oh, wow, what coincidence: this bug is actually *fixed* by bug 740259 ! (Bug 740259 added some strong asserts that caught a bug in group assignment where we forgot to call MaybeEmitVarDecl.)
(It looks like the patch isn't in Nightly yet, but it should be very soon.) Thanks for reporting!
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
Updated•14 years ago
|
Flags: in-testsuite?
Resolution: DUPLICATE → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•