No problem... I haven't handled the common super-expression case (if
(test) { return a; } else {return b; } -> return test ? a : b), but
that one should be pretty easy to tackle for a limited set of common
super-expressions.
On 11-Jun-09, at 5:53 AM, Joel Webber wrote:
> FWIW:
>
> http://code.google.com/p/google-web-toolkit/wiki/BooleanIfExpressionOptimization
>
> http://code.google.com/p/google-web-toolkit/wiki/IfToTernaryExpressionOptimization
>
> Thanks again for banging on these. I've been meaning to do it for
> ages...
>
> On Wed, Jun 10, 2009 at 9:11 PM, <[email protected]> wrote:
>
> Reviewers: scottb,
>
> Description:
> As suggested by scottb, we can optimize certain if statements to their
> boolean equivalents, ie:
>
> if (a()) {b()} else {c()} -> a()?b():c()
>
> if (a()) {b()} -> a()&&b()
>
> if (a()) {} else {b()} -> a()||b()
>
>
>
> Please review this at http://gwt-code-reviews.appspot.com/36801
>
> Affected files:
> dev/core/src/com/google/gwt/dev/js/JsStaticEval.java
> dev/core/test/com/google/gwt/dev/js/JsStaticEvalTest.java
>
>
>
>
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---