Closed Bug 410981 Opened 15 years ago Closed 15 years ago

js1_7/decompilation/regress-356247.js - for (let) allows let as child without block

Categories

(Core :: JavaScript Engine, defect, P1)

defect

Tracking

()

VERIFIED FIXED
mozilla1.9beta3

People

(Reporter: bc, Assigned: brendan)

References

Details

Attachments

(1 file, 1 obsolete file)

js> (function() { for(let x in []) let {} = [1]; })
function () {
    for (let x in []) {
        let [] = [1];
    }
}
Flags: in-testsuite+
Flags: in-litmus-
Priority: -- → P1
Target Milestone: --- → mozilla1.9 M11
Status: NEW → ASSIGNED
Flags: blocking1.9+
Hardware: PC → All
Of course, this exists only given 'for (let x...)' and equivalent let bindings in for loop initial parts, and for-in loop left-hand sides. Such bindings make a block scope around the loop body (and condition and update parts, if for rather than for-in). This means the decompilation is not accurate, but it does not mean the for loop's enclosing scope is polluted by the let in the body. E.g., in

  for (let x in [1,2,3]) let y = x*x

y does not escape the loop body's implicit block scope.

/be
Attached patch fix (obsolete) — Splinter Review
Attachment #295586 - Flags: review?(mrbkap)
Attachment #295586 - Flags: review?(mrbkap) → review+
Comment on attachment 295586 [details] [diff] [review]
fix

@@ -3194,17 +3195,18 @@ Statement(JSContext *cx, JSTokenStream *

the comment described what the old if did, afaict it no longer describes the current logic.
Thanks, timeless!

/be
Attachment #295586 - Attachment is obsolete: true
Attachment #295744 - Flags: review+
Attachment #295744 - Flags: approval1.9+
Fixed:

js/src/jsemit.h 3.88
js/src/jsparse.c 3.322

/be
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
The following also required updating now that this is fixed. 

/cvsroot/mozilla/js/tests/js1_7/extensions/regress-346642-06.js,v
new revision: 1.4; previous revision: 1.3
Blocks: 411279
No longer blocks: 411279
v
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.