Make add-linker accept conditionals based on module properties? Then rebinds
and linkers can have unified predicates.

--Bob (Android)

On Dec 21, 2009 5:51 PM, "Lex Spoon" <[email protected]> wrote:

There are a couple of different ways that the choice of linker affects
what the compiler should do with runAsync:

1. If the code will be loaded inside a nested function, then variable
and function definitions need to be rewritten if they are referenced
on a different fragment than the one that loads them.

2. If the code could be loaded in violation of the same origin policy,
then a script tag rather than XHR needs to be used to download the
code.


One way to allow this sort of flexibility would be to add methods to
the Linker API.  However, it's hard to see what the extensions should
look like.  Unless there is a general ability to add new passes via
the Linker API, there would have to be a new method in the API for
each compiler option a linker might ever influence.

Instead, how about allowing deferred bindings to be controlled by the
linker choice?  Then, if linker A is chosen, it could flip deferred
binding B.  A specific syntax could be as follows:

 <replace-with

 class="com.google.gwt.core.client.impl.AsyncFragmentLoader.StandardLogger">
   <when-type-is
class="com.google.gwt.core.client.impl.AsyncFragmentLoader.Logger" />
   <when-linkers-include name="xs" />
 </replace-with>



This looks both simple and general.  Does this seem reasonable?  Does
anyone see a better way?

Lex Spoon

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

Reply via email to