diff options
author | Mihai Bazon <mihai@bazon.net> | 2013-02-06 11:51:09 +0200 |
---|---|---|
committer | Mihai Bazon <mihai@bazon.net> | 2013-02-06 11:51:09 +0200 |
commit | f36e4e9a785e9c1d5bc6212589aa745f5ef487c0 (patch) | |
tree | 0dbd8e7b901d58a18829426fa9492caafd1c2e05 /lib | |
parent | fdf8b5eb71f762c6a021775609a6333ed110f17b (diff) | |
download | tracifyjs-f36e4e9a785e9c1d5bc6212589aa745f5ef487c0.tar.gz tracifyjs-f36e4e9a785e9c1d5bc6212589aa745f5ef487c0.zip |
Give up evaluating (unary-prefix '-' 0)
Close #117
------
JS, WHY YOU SUCK SO BADLY? ;-(
Diffstat (limited to 'lib')
-rw-r--r-- | lib/compress.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js index fe3d34b6..ca23c40e 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -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; |