On Thu, Jul 2, 2009 at 3:23 PM, Ian Petersen <ispet...@gmail.com> wrote:

>
>
> Had a pretty random thought on the way to the bathroom: "new
> Foo().bar()" is equivalent to "(new Foo).bar()".  Is it equivalent to
> "new Foo.bar()"?  I would expect not.  Does that matter?  Does the
> compiler generate code that looks like "new Foo.bar()" with your patch
> in place?
>

The compiler (the code-gen JsToStringGenerator part) has a precedence
checking routine for handling this. If you do new Foo().bar, if will replace
it with (new Foo).bar. Since the JsInvocation ("new" operator) is supposed
to bind tighter with the JsNameRef in the constructor expression than the
'bar' name ref is to the "new".


-Ray


>
> Ian
>
> >
>

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

Reply via email to