Lots of static evaluation rules, mostly on the Java trees.

JsStaticEval: changes !!x to x within any boolean context

GenerateJavaAST: change if (x == null) to if (!x), if (x != null) to if (!!x) (except where x can be String)

DeadCodeElimination:
- constant fold all operations on all types of literals
- != and == where on argument is true or false
- +/- 0
- * or / on 1, -1
- x*0 -> 0
- 0-x -> -x
- if (!x) foo; else bar;  ->  if (x) bar; else foo;
- (!x) ? foo : bar;  ->  x ? bar : foo
- ^ with a literal true or false
- "- -x"  ->  "x"
- <</>>/>>> with an argument of 0

Issue: 1511
Patch by: spoon (w/ minor mods me JsStaticEval)
Review by: me


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@2515 8db76d5a-ed1c-0410-87a9-c151d255dfc7
7 files changed