summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2013-08-02 14:27:42 +0200
committerEugene Burmako <xeno.by@gmail.com>2013-08-10 18:06:24 +0200
commit26a86793596c331ec19a8a584c6ff66d8d2acaef (patch)
tree0e38037f6916c764dcd49fef499e166dbd0c73a3 /src/compiler
parented5c1abbfca18a880c79048cc7e9578ae932101d (diff)
downloadscala-26a86793596c331ec19a8a584c6ff66d8d2acaef.tar.gz
scala-26a86793596c331ec19a8a584c6ff66d8d2acaef.tar.bz2
scala-26a86793596c331ec19a8a584c6ff66d8d2acaef.zip
currentRun.compiles now correctly works in toolboxes
Another random bug uncovered and extinguished when hacking macro annots.
Diffstat (limited to 'src/compiler')
-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()