Closed Bug 351597 Opened 18 years ago Closed 18 years ago

Incorrect decompilation with "new" operator and extra parens

Categories

(Core :: JavaScript Engine, defect, P1)

defect

Tracking

()

VERIFIED FIXED
mozilla1.8.1

People

(Reporter: jruderman, Assigned: brendan)

References

Details

(Keywords: regression, testcase, verified1.8.1)

Attachments

(1 file)

js> function() { new ((x=a))(y) }     
function () {
    new x = a(y);
}

Attempting to compile the result gives me "invalid assignment left-hand side".

I suspect this is a regression from bug 350531.
Yes -- my exhaustive tester did not handle all operators.  It should, because untested == broken.  Fix coming up here, and I'll work on the test more today.

/be
Assignee: general → brendan
Depends on: 350531
OS: Mac OS X 10.4 → All
Priority: -- → P1
Hardware: Macintosh → All
Target Milestone: --- → mozilla1.8.1
Status: NEW → ASSIGNED
Two JSOP_GROUPs in a row (we should peephole optimize those away, in a future bug fix patch) meant that the stacked op for the callee was JSOP_GROUP instead of the low-precedence JSOP_SETNAME when we got to JSOP_NEW.

/be
Attachment #237008 - Flags: review?(mrbkap)
Attachment #237008 - Flags: review?(mrbkap) → review+
Fixed on trunk.

/be
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Comment on attachment 237008 [details] [diff] [review]
one-line (9 char!) fix

This is a completely safe fix to a regression from the patch for bug 350531.  It fulfills the intent of that bug's fix: to leave parenthesization to the postfix-to-infix precedence-based logic in the decompiler, instead of trying to guess which JSOP_GROUPs should turn into parens around their operand.

/be
Attachment #237008 - Flags: approval1.8.1?
Checking in regress-351597.js;
/cvsroot/mozilla/js/tests/js1_5/Regress/regress-351597.js,v  <--  regress-351597.js
initial revision: 1.1
Flags: in-testsuite+
Comment on attachment 237008 [details] [diff] [review]
one-line (9 char!) fix

a=beltzner on behalf of 181drivers
Attachment #237008 - Flags: approval1.8.1? → approval1.8.1+
Fixed on the 1.8 branch.

/be
Keywords: fixed1.8.1
verified fixed 1.9a1_2006090707 windows/mac*/linux
Status: RESOLVED → VERIFIED
verified fixed 1.8 1.9 20060909 windows/mac*/linux
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: