summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/reflect/ToolBoxFactory.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-08-12 01:51:47 -0700
committerJason Zaugg <jzaugg@gmail.com>2013-08-12 01:51:47 -0700
commitb246c64fb7b0640ad54b60e87b26026e98818a58 (patch)
treeecb833ec58a329fc697eddbd038a5027a3d290ed /src/compiler/scala/tools/reflect/ToolBoxFactory.scala
parentfb3725c9427b91844155112e116e5f12a87e9e6a (diff)
parent26a86793596c331ec19a8a584c6ff66d8d2acaef (diff)
downloadscala-b246c64fb7b0640ad54b60e87b26026e98818a58.tar.gz
scala-b246c64fb7b0640ad54b60e87b26026e98818a58.tar.bz2
scala-b246c64fb7b0640ad54b60e87b26026e98818a58.zip
Merge pull request #2817 from xeno-by/topic/toolbox-current-run-compiles
currentRun.compiles now correctly works in toolboxes
Diffstat (limited to 'src/compiler/scala/tools/reflect/ToolBoxFactory.scala')
-rw-r--r--src/compiler/scala/tools/reflect/ToolBoxFactory.scala5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/reflect/ToolBoxFactory.scala b/src/compiler/scala/tools/reflect/ToolBoxFactory.scala
index ec61f7a945..b9541ece5d 100644
--- a/src/compiler/scala/tools/reflect/ToolBoxFactory.scala
+++ b/src/compiler/scala/tools/reflect/ToolBoxFactory.scala
@@ -15,6 +15,7 @@ import java.lang.{Class => jClass}
import scala.compat.Platform.EOL
import scala.reflect.NameTransformer
import scala.reflect.api.JavaUniverse
+import scala.reflect.io.NoAbstractFile
abstract class ToolBoxFactory[U <: JavaUniverse](val u: U) { factorySelf =>
@@ -138,7 +139,9 @@ abstract class ToolBoxFactory[U <: JavaUniverse](val u: U) { factorySelf =>
val wrapper2 = if (!withMacrosDisabled) (currentTyper.context.withMacrosEnabled[Tree] _) else (currentTyper.context.withMacrosDisabled[Tree] _)
def wrapper (tree: => Tree) = wrapper1(wrapper2(tree))
- phase = (new Run).typerPhase // need to set a phase to something <= typerPhase, otherwise implicits in typedSelect will be disabled
+ val run = new Run
+ run.symSource(ownerClass) = NoAbstractFile // need to set file to something different from null, so that currentRun.defines works
+ phase = run.typerPhase // need to set a phase to something <= typerPhase, otherwise implicits in typedSelect will be disabled
currentTyper.context.setReportErrors() // need to manually set context mode, otherwise typer.silent will throw exceptions
reporter.reset()