diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2013-11-22 17:23:45 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2013-11-22 19:13:24 +0100 |
commit | 0c963c90855eb0811bc1b6c3ab35814ee0768f13 (patch) | |
tree | 74317fcd3dbd6de645289381cf9835309ef3e18e /src | |
parent | 2ad9666ce8863814dd5d27f1d43739e89c8c286b (diff) | |
download | scala-0c963c90855eb0811bc1b6c3ab35814ee0768f13.tar.gz scala-0c963c90855eb0811bc1b6c3ab35814ee0768f13.tar.bz2 scala-0c963c90855eb0811bc1b6c3ab35814ee0768f13.zip |
[nomaster] teaches toolbox about -Yrangepos
Unlike in master, in 2.10.x enabling -Yrangepos requires instantiating
Global with mixed in RangePositions trait.
Same story for toolboxes. Just setting Yrangepos is not enough - one
needs to mix in RangePositions into ToolboxGlobal. I didn’t know that
back then, so now I’m fixing the oversight.
The commit is marked as [nomaster], because -Yrangepos doesn’t need
special treatment in master.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/reflect/ToolBoxFactory.scala | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/reflect/ToolBoxFactory.scala b/src/compiler/scala/tools/reflect/ToolBoxFactory.scala index b9541ece5d..8803980dac 100644 --- a/src/compiler/scala/tools/reflect/ToolBoxFactory.scala +++ b/src/compiler/scala/tools/reflect/ToolBoxFactory.scala @@ -16,6 +16,7 @@ import scala.compat.Platform.EOL import scala.reflect.NameTransformer import scala.reflect.api.JavaUniverse import scala.reflect.io.NoAbstractFile +import scala.tools.nsc.interactive.RangePositions abstract class ToolBoxFactory[U <: JavaUniverse](val u: U) { factorySelf => @@ -329,8 +330,12 @@ abstract class ToolBoxFactory[U <: JavaUniverse](val u: U) { factorySelf => try { val errorFn: String => Unit = msg => frontEnd.log(scala.reflect.internal.util.NoPosition, msg, frontEnd.ERROR) val command = new CompilerCommand(arguments.toList, errorFn) - command.settings.outputDirs setSingleOutput virtualDirectory - val instance = new ToolBoxGlobal(command.settings, frontEndToReporter(frontEnd, command.settings)) + val settings = command.settings + settings.outputDirs setSingleOutput virtualDirectory + val reporter = frontEndToReporter(frontEnd, command.settings) + val instance = + if (settings.Yrangepos.value) new ToolBoxGlobal(settings, reporter) with RangePositions + else new ToolBoxGlobal(settings, reporter) if (frontEnd.hasErrors) { var msg = "reflective compilation has failed: cannot initialize the compiler: " + EOL + EOL msg += frontEnd.infos map (_.msg) mkString EOL |