Closed Bug 352277 Opened 18 years ago Closed 18 years ago

Round-trip change with nested ternary and extra parens

Categories

(Core :: JavaScript Engine, defect)

PowerPC
macOS
defect
Not set
minor

Tracking

()

RESOLVED DUPLICATE of bug 352261

People

(Reporter: jruderman, Unassigned)

Details

(Keywords: testcase)

js> p = function() { return (x ? 1 : 2) ? 3 : 4 }
function () {
    return x ? 1 : 2 ? 3 : 4;
}

js> eval("" + p)
function () {
    return x ? 1 : 3;
}

I don't know if this is just a round-trip change (harmless except for fuzzing) or an indicator that there's a real bug.
This is a parenthesization bug.  ?: is right associative, you are forcing left association, your parens should be preserved.  They are if you update your build:

js> p = function() { return (x ? 1 : 2) ? 3 : 4 }
function () {
    return (x ? 1 : 2) ? 3 : 4;
}

This is a dup of bug 352261.

/be

*** This bug has been marked as a duplicate of 352261 ***
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.