Skip to content

Commit b88b79d

Browse files
committed
Allow to provide parent Context for Driver.process
1 parent 3df6dce commit b88b79d

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/dotty/tools/dotc/Bench.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ object Bench extends Driver {
4646
else (args(pos + 1).toInt, (args take pos) ++ (args drop (pos + 2)))
4747
}
4848

49-
override def process(args: Array[String]): Reporter = {
49+
override def process(args: Array[String], rootCtx: Context): Reporter = {
5050
val (numCompilers, args1) = extractNumArg(args, "#compilers")
5151
val (numRuns, args2) = extractNumArg(args1, "#runs")
5252
this.numRuns = numRuns
53-
ntimes(numCompilers)(super.process(args2))
53+
ntimes(numCompilers)(super.process(args2, rootCtx))
5454
}
5555
}
5656

src/dotty/tools/dotc/Driver.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ abstract class Driver extends DotClass {
2222

2323
protected def initCtx = (new ContextBase).initialCtx
2424

25-
def process(args: Array[String]): Reporter = {
26-
val summary = CompilerCommand.distill(args)(initCtx)
25+
def process(args: Array[String], rootCtx: Context): Reporter = {
26+
val summary = CompilerCommand.distill(args)(rootCtx)
2727
implicit val ctx: Context = initCtx.fresh.setSettings(summary.sstate)
2828
val fileNames = CompilerCommand.checkUsage(summary)
2929
try {
@@ -41,7 +41,7 @@ abstract class Driver extends DotClass {
4141
}
4242

4343
def main(args: Array[String]): Unit =
44-
sys.exit(if (process(args).hasErrors) 1 else 0)
44+
sys.exit(if (process(args, initCtx).hasErrors) 1 else 0)
4545
}
4646

4747
class FatalError(msg: String) extends Exception

test/test/CompilerTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class CompilerTest extends DottyTest {
1313
def compileArgs(args: Array[String], xerrors: Int = 0): Unit = {
1414
val allArgs = args ++ defaultOptions
1515
val processor = if (allArgs.exists(_.startsWith("#"))) Bench else Main
16-
val nerrors = processor.process(allArgs).count(Reporter.ERROR.level)
16+
val nerrors = processor.process(allArgs, ctx).count(Reporter.ERROR.level)
1717
assert(nerrors == xerrors, s"Wrong # of errors. Expected: $xerrors, found: $nerrors")
1818
}
1919

0 commit comments

Comments
 (0)