blob: 07f9ac6b84ea82d59e568c74c47765dc6d6cbebf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
import scala.tools.nsc.reporters._
import scala.tools.nsc.Settings
import reflect.runtime.Mirror.ToolBox
object Test extends App {
val code = scala.reflect.Code.lift{
object C {
val x = 2
}
println(C.x)
};
val reporter = new ConsoleReporter(new Settings)
val toolbox = new ToolBox(reporter)
val evaluated = toolbox.runExpr(code.tree)
println("evaluated = " + evaluated)
}
|