Closed Bug 461110 Opened 16 years ago Closed 16 years ago

Extra parens in decompilation of "a += b = 3"

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
minor

Tracking

()

RESOLVED FIXED

People

(Reporter: jruderman, Assigned: jorendorff)

References

Details

(Keywords: regression, testcase)

Attachments

(1 file)

js> (function() { a += b = 3 })
function () {
    a += (b = 3);
}
This can happen with operators other than = on the right, such as instanceof.
Why is this bad? It makes it clearer.
It's different, so expected output in testsuites and tools will need to be updated. It's not mandatory per the C-based operator precedence. And clearer mileage varies -- we wouldn't have changed this just to make it clearer by some lights.

I'm most interested in why it pops out of the precedence-based decompiler. If it is a natural consequence that would take particularly ugly, or just too much, extra code to fix, then it can stay. Jason, is the + in += messing things up?

/be
Attached patch v1Splinter Review
Assignee: general → jorendorff
Attachment #344323 - Flags: review?(brendan)
Comment on attachment 344323 [details] [diff] [review]
v1

I should have seen this -- this patch improves things even if it adds lines of code, since it reduces the complexity in the POP_STR_PREC calls.

/be
Attachment #344323 - Flags: review?(brendan) → review+
http://hg.mozilla.org/tracemonkey/rev/5203db613b10
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
http://hg.mozilla.org/mozilla-central/rev/37b3fdbb0f07
/cvsroot/mozilla/js/tests/js1_5/decompilation/regress-461110.js,v  <--  regress-461110.js
initial revision: 1.1
Flags: in-testsuite+
Flags: in-litmus-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: