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