scala-js/scala-js — pull request #511 by sjrd (2014-04-23 18:58:04+00:00)
Title: Push the IR until linking

Now that we have a nice new IR, independent of `nsc`'s codebase, we can serialize it instead of generating JavaScript right away, and push it as far as the packaging or fast-optimizing (or running).

This PR first contains 2 commits that move the "stage" at which IR is expanded to JavaScript twice. Before this PR it is expanded right inside the compiler.
* With the first commit, it is expanded only when the `ScalaJSClasspath` is built: .sjsir files are deserialized, desugared and emitted as in-memory JavaScript files right there.
* With the second commit, IR files are kept even longer, and the packager/fast-optimizer/runner expand them. This is much better because they can expand 1) only what they really need and 2) directly to the linked file.

It is probably worth considering squashing the two commits, but maybe having them separated is easier to understand.

Then, this unfortunately *slows down* the fast optimizer in incremental setups, which is a very bad thing. To fix this, the third commit introduces caching of the desugared pieces that are needed right inside the fast-optimizer. This gives us back the fast dev cycle with `fastOptJS`.