Improve positions of some class definitions.
Fix #496: conversions from JS prims to Scala types are unsafe.

* js.prim.Number  -> Double: makePrimitiveUnbox to `Double`
  (null becomes 0, numbers become themselves, everything else throws)
* js.prim.Boolean -> Boolean: makePrimitiveUnbox to `Boolean`
  (null becomes false, booleans become themselves, everything else throws)
* js.prim.String  -> String: `.asInstanceOf[String]`
  (null and strings become themselves, everything else throws)
Merge pull request #502 from sjrd/before-new-ir

Small fixes
New intermediate representation (IR).

This new IR is meant to be an interchange format between the
compiler and the packager and optimizers (instead of raw
JavaScript code), so that inlining will eventually be possible.
In this commit, though, it simply replaces the JS Trees as an
intermediate representation in the compiler: the compiler
emits the IR and immediately desugars it in the JavaScript
subset, which is emitted as source code as before.

Some highlights of the IR compared to JS trees:
* It represents Scala.js classes independent of an encoding
  (so the variable `ScalaJS` and its fields are never in the IR)
* It is statically typed, with an additional `dyn` type.
  (note: I said it is *statically typed*; I did not say it was
  *typechecked*!)
Merge pull request #493 from sjrd/smart-optimizer-1st-review

New intermediate representation (IR)
Refactor hierarchy of virtual files to VirtualTextFiles.

The current virtual files are implicitly text files, but
eventually we will need to also represent virtual binary
files. This commit refactors the hierarchy to separate
VirtualTextFile (text) from VirtualFile (agnostic). This
refactoring will allow the later introduction of binary
files as VirtualBinaryFiles.
Add serializer and deserializer of the IR.
Emit serialized IR files instead of .js + .js.map + .sjsinfo.

The ClasspathBuilder automatically expand .sjsir files into their
desugared VirtualScalaJSClassfile version for now. It is left for
a future commit to get rid of VirtualScalaJSClassfile entirely and
have the packager and optimizer to work directly on the IR file.
Remove VirtualScalaJSClassfile and use VirtualScalaJSIRFile instead.

Now the various tasks working with a ScalaJSClasspath extract the
information they need from the IR directly, and work with that.