Skip to content

Commit

Permalink
Give up evaluating (unary-prefix '-' 0)
Browse files Browse the repository at this point in the history
Close #117

------

    JS, WHY YOU SUCK SO BADLY? ;-(
  • Loading branch information
mishoo committed Feb 6, 2013
1 parent fdf8b5e commit f36e4e9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/compress.js
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,10 @@ merge(Compressor.prototype, {
case "typeof": return typeof ev(e);
case "void": return void ev(e);
case "~": return ~ev(e);
case "-": return -ev(e);
case "-":
e = ev(e);
if (e === 0) throw def;
return -e;
case "+": return +ev(e);
}
throw def;
Expand Down

1 comment on commit f36e4e9

@rvanvelzen
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's actually easy to test for -0: 1 / -0 === -Infinity

Please sign in to comment.