more optimizations that v1 does and some cleanups

- a = a + x ==> a+=x
- joining consecutive var statements (hoisting is not always desirable)
- x == false ==> x == 0, x != true ==> x != 1
- x, x ==> x; x = exp(), x ==> x = exp()
- discarding useless break-s
This commit is contained in:
Mihai Bazon
2012-09-14 15:36:38 +03:00
parent 93b973c99d
commit 924aa58060
6 changed files with 256 additions and 79 deletions

View File

@@ -1,11 +1,11 @@
a = a + x ==> a+=x
a = a + x ==> a+=x
*******
join consecutive var statements
join consecutive var statements
*******
x == false ==> x == 0
x == true ==> x == 1
@@ -14,6 +14,8 @@ JS is so sloppy that this could be an indication of a bug.
*******
x, x ==> x
x = foo, x ==> x
@@ -30,6 +32,8 @@ XXX? Not sure if this is worth the trouble.
*******
discard spurious break statements
*******