diff options
-rw-r--r-- | src/dotty/tools/backend/jvm/DottyBackendInterface.scala | 4 | ||||
-rw-r--r-- | src/dotty/tools/backend/jvm/GenBCode.scala | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/dotty/tools/backend/jvm/DottyBackendInterface.scala b/src/dotty/tools/backend/jvm/DottyBackendInterface.scala index b6adba85a..5776cc8e2 100644 --- a/src/dotty/tools/backend/jvm/DottyBackendInterface.scala +++ b/src/dotty/tools/backend/jvm/DottyBackendInterface.scala @@ -32,7 +32,7 @@ import NameOps._ import StdNames.nme import NameOps._ -class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{ +class DottyBackendInterface(outputDirectory: AbstractFile)(implicit ctx: Context) extends BackendInterface{ type Symbol = Symbols.Symbol type Type = Types.Type type Tree = tpd.Tree @@ -734,7 +734,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{ def setter(clz: Symbol): Symbol = decorateSymbol(sym).setter def moduleSuffix: String = "" // todo: validate that names already have $ suffix - def outputDirectory: AbstractFile = new PlainDirectory(new Directory(new JFile(ctx.settings.d.value))) + def outputDirectory: AbstractFile = DottyBackendInterface.this.outputDirectory def pos: Position = sym.pos def throwsAnnotations: List[Symbol] = Nil diff --git a/src/dotty/tools/backend/jvm/GenBCode.scala b/src/dotty/tools/backend/jvm/GenBCode.scala index e8d196ce7..2d444d3be 100644 --- a/src/dotty/tools/backend/jvm/GenBCode.scala +++ b/src/dotty/tools/backend/jvm/GenBCode.scala @@ -29,6 +29,7 @@ import scala.tools.asm.tree._ import dotty.tools.dotc.util.{Positions, DotClass} import tpd._ import StdNames._ +import scala.reflect.io.{Directory, PlainDirectory, AbstractFile} import scala.tools.nsc.backend.jvm.opt.LocalOpt @@ -37,9 +38,11 @@ class GenBCode extends Phase { private val entryPoints = new mutable.HashSet[Symbol]() def registerEntryPoint(sym: Symbol) = entryPoints += sym + def outputDir(implicit ctx: Context): AbstractFile = + new PlainDirectory(new Directory(new JFile(ctx.settings.d.value))) def run(implicit ctx: Context): Unit = { - new GenBCodePipeline(entryPoints.toList, new DottyBackendInterface()(ctx))(ctx).run(ctx.compilationUnit.tpdTree) + new GenBCodePipeline(entryPoints.toList, new DottyBackendInterface(outputDir)(ctx))(ctx).run(ctx.compilationUnit.tpdTree) entryPoints.clear() } } |