Class file creation from Toolbox compilation



I use the following to compile code at runtime (works fine):

  val toolbox =

  /** source shouldn't contain package statements (TODO: why?) */
  def objectInstance[A](
      objectDefinition : String,
      objectName       : String /* TODO: parse source to extract name rather? */): A = {

    val source      : String         = objectDefinition.newline(objectName) // because must return an instance it seems
    val tree        : toolbox.u.Tree = toolbox.parse  (source)
    val anyProducer : () => Any      = toolbox.compile(tree)    


However I can’t seem to find a way to actually write a corresponding class file, if that’s even possible. Anybody knows?