From cd4004a82d9713bbb0b120aba83b3ed8fc9f1372 Mon Sep 17 00:00:00 2001 From: Sébastien Doeraene Date: Fri, 26 Feb 2016 16:30:39 +0100 Subject: Initial infrastructure and hello world for the Scala.js back-end. The Scala.js back-end can be enabled with the `-scalajs` command-line option. Currently, it adds one phase to the pipeline, which emits .sjsir files from trees. A sandbox project `sjsSandbox`, in `sandbox/scalajs/`, can be used to easily test Scala.js compilation. One can run the `main()` method of the `hello.world` object with > sjsSandbox/run The back-end only contains the bare mimimum to compile the hello world application in the sandbox. Anything else will blow up (for example, primitive method calls). It is a work-in-progress. --- sandbox/scalajs/hello.scala | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 sandbox/scalajs/hello.scala (limited to 'sandbox') diff --git a/sandbox/scalajs/hello.scala b/sandbox/scalajs/hello.scala new file mode 100644 index 000000000..bd4aa8cc5 --- /dev/null +++ b/sandbox/scalajs/hello.scala @@ -0,0 +1,15 @@ +package hello + +import scala.scalajs.js + +trait MyTrait { + val x = 5 + def foo(y: Int) = x +} + +object world extends js.JSApp with MyTrait { + def main(): Unit = { + println("hello dotty.js!") + println(foo(4)) + } +} -- cgit v1.2.3