This might be a candidate for adding to
http://code.google.com/p/google-web-toolkit/wiki/VariableDeclarationListOptimization
which is to hoist multiple var declarations into a single declaration, as
well as hoisting the first assignments of each. Care would have to be taken
to make sure side effects are taken care of properly.

-Ray


On Thu, Jul 2, 2009 at 3:21 PM, Andrés Testi <[email protected]>wrote:

>
> Even more code reduction could be done declaring all vars in the same
> place:
>
> function Foo1(){}
> function Foo2(){}
> function Foo3(){}
>
> ... could be reduced to
>
> var Foo1=d(),Foo2=d(),Foo3=d();
>
> - Andrés
>
>
> On 2 jul, 19:11, Andrés Testi <[email protected]> wrote:
> > Having a function like:
> >
> >   function d(){
> >     return function(){};
> >   }
> >
> > ... class declarations like:
> >
> >   function Foo(){}
> >
> > ... could be reduced to:
> >
> >   var Foo=d()
> >
> > ... reducing compiled code by 5 characters for each declaration.
> >
> > - Andrés
> >
>

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to