Skip to content

Instantly share code, notes, and snippets.

@Sciss
Created December 27, 2017 17:49
Show Gist options
  • Save Sciss/b6bc47ffcdbc5a9aa4b8678c85718dd6 to your computer and use it in GitHub Desktop.
Save Sciss/b6bc47ffcdbc5a9aa4b8678c85718dd6 to your computer and use it in GitHub Desktop.
// Simon Schäfer in Scala-IDE gitter
val outputDir = new VirtualDirectory("<virtualdir>", None)
val settings = new Settings(err ⇒ Console.err.println(err))
settings.outputDirs.setSingleOutput(outputDir)
settings.usejavacp.value = true
settings.source.value = ScalaVersion("2.12.1")
val reporter = new StoreReporter
val compiler = new Global(settings, reporter)
import compiler._
val src = "class Test { val x = 0 }"
val srcFile = newSourceFile(src)
val run = new compiler.Run
val resp = new Response[compiler.Tree]
import compiler._
val resp1 = new Response[Unit]
compiler.askReload(List(srcFile), resp1)
resp1.get
compiler.askLoadedTyped(srcFile, keepLoaded = true, resp)
val tree = resp.get.left.get
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment