Opened 10 years ago

Closed 10 years ago

#9676 closed defect (fixed)

Shrinksafe handles unary "+" operator incorrectly

Reported by: ppedemon Owned by: Adam Peller
Priority: high Milestone: 1.4
Component: ShrinkSafe Version: 1.1.0
Keywords: unary plus Cc: Richard Backhouse
Blocked By: Blocking:

Description

Shrinksafe doesn't handle unary plus operator correctly. For example, the following snippet:

var dummy = 1 + +2;
console.log(dummy);

Is turned into this (keeping original var names):

var dummy = 1++2;
console.log(dummy);

That's not legal Javascript syntax, so when executing Shrinksafe's output, you'll get an "Invalid increment operand" syntax error.

You can argue that no one writes code like this (in fact, my extra "+" when I discovered the error was a typo), but unary plus is legal javascript after all.

NB: I'm reporting for Dojo 1.1.0, but it might be present in newer versions as well.

Change History (6)

comment:1 Changed 10 years ago by Adam Peller

Cc: Richard Backhouse added; Adam Peller removed
Milestone: 1.4
Owner: changed from alex to Adam Peller

comment:2 Changed 10 years ago by Adam Peller

Resolution: fixed
Status: newclosed

Fixed in [20177]

comment:3 Changed 10 years ago by Adam Peller

(In [20178]) Cover case with adjoining sub and neg operators as well. Refs #9676

comment:4 Changed 10 years ago by youngho

shrinksafe.jar file didn't updated for this change.

comment:5 Changed 10 years ago by Adam Peller

Resolution: fixed
Status: closedreopened

good point... will keep this open to make sure we regenerate this for 1.4

comment:6 Changed 10 years ago by Adam Peller

Resolution: fixed
Status: reopenedclosed

(In [20227]) Rebuilt shrinksafe. Fixes #9676

Note: See TracTickets for help on using tickets.