Closed Bug 349648 Opened 18 years ago Closed 18 years ago

Extra "[" in decompilation of nested array comprehensions

Categories

(Core :: JavaScript Engine, defect, P1)

defect

Tracking

()

VERIFIED FIXED
mozilla1.8.1

People

(Reporter: jruderman, Assigned: brendan)

References

Details

(Keywords: testcase, verified1.8.1, Whiteboard: [schrep-181approval pending])

Attachments

(1 file, 1 obsolete file)

> function(){ [[0 for (x in [])] for (y in []) ]; }

function () { [[0 for (x in [])] for (y in [])[]; }
                                              ^---- does not belong

This causes a syntax error if I try to use the decompiled function.
Attached patch trim xval a little differently (obsolete) — Splinter Review
I understand enough of jsopcode.c to be dangerous.


> function(){ [[0 for (x in [])] for (y in []) ]; }
function () { [[0 for (x in [])] for (y in [])]; }

> function(){ [[0 for (x in [])] for (yyyyyyyyyyy in []) ]; }
function () { [[0 for (x in [])] for (yyyyyyyyyyy in [])]; }

> function(){ [0 for (x in [])]; }
function () { [0 for (x in [])]; }

> function(){ [[[0 for (x in [])] for (yyyyyyyyyyy in []) ] for (zzz in [])]; }
function () { [[[0 for (x in [])] for (yyyyyyyyyyy in [])] for (zzz in [])]; }
Attachment #235609 - Flags: review?(brendan)
Attachment #235609 - Flags: review?(brendan)
Brave to dive into the bytecode-resugaring hack that is the decompiler!

The patch fixes the testcase in comment 0, but not a variation that makes the initializing expression longer:

js> function(){ [[0 for (x in [])] for (y in []) ]; }
function () {
    [[0 for (x in [])] for (y in [])];
}
js> function(){ [[11 for (x in [])] for (y in []) ]; }
function () {
    [[11 for (x in [])1] for (y in [])];
}

More in a bit.

/be
Typo, really -- when you get intermediate decompiler results replayed in the final result, it usually means a failure to pop or retract.

/be
Assignee: general → brendan
Attachment #235609 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #235624 - Flags: superreview?(mrbkap)
Attachment #235624 - Flags: review?(sayrer)
Attachment #235624 - Flags: approval1.8.1?
OS: Mac OS X 10.4 → All
Priority: -- → P1
Hardware: Macintosh → All
Target Milestone: --- → mozilla1.8.1
Safe one character (!) fix for js1.7.

/be
Blocks: js1.7
Flags: blocking1.8.1?
Comment on attachment 235624 [details] [diff] [review]
fix: retract to the point we're overwriting with Sprint

> The patch fixes the testcase in comment 0, but not a variation that makes the
> initializing expression longer:
> 

yeah, I cancelled review when I figured that out. :)

r=sayrer
Attachment #235624 - Flags: review?(sayrer) → review+
Attachment #235624 - Flags: superreview?(mrbkap) → superreview+
Fixed on trunk.

/be
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Whiteboard: [schrep-181approval pending]
Comment on attachment 235624 [details] [diff] [review]
fix: retract to the point we're overwriting with Sprint

a=schrep/beltnzer for drivers.
Attachment #235624 - Flags: approval1.8.1? → approval1.8.1+
Flags: blocking1.8.1? → blocking1.8.1+
Fixed on the 1.8 branch.

/be
Keywords: fixed1.8.1
Checking in regress-349648.js;
/cvsroot/mozilla/js/tests/js1_5/Regress/regress-349648.js,v  <--  regress-349648.js
initial revision: 1.1
Flags: in-testsuite+
verified fixed 1.8 20060828 windows/mac*/linux
verified fixed 1.9 20060830 windows/mac*/linux
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: