From 7827c5ae1744583974f9c99432c1082ea6cb8997 Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Wed, 3 Feb 2016 23:27:49 +0100 Subject: Better compiler entry points - Document the entry points - It is now possible to set a custom reporter without using a custom context - Use `null` for optional arguments to make it easier to run the compiler using reflection or from Java. - DPDirectCompiler does not use a custom context anymore --- test/dotty/partest/DPDirectCompiler.scala | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'test/dotty/partest') diff --git a/test/dotty/partest/DPDirectCompiler.scala b/test/dotty/partest/DPDirectCompiler.scala index 4e563820f..410dac338 100644 --- a/test/dotty/partest/DPDirectCompiler.scala +++ b/test/dotty/partest/DPDirectCompiler.scala @@ -13,20 +13,14 @@ class DPDirectCompiler(runner: DPTestRunner) extends nest.DirectCompiler(runner) val clogWriter = new PrintWriter(clogFWriter, true) clogWriter.println("\ncompiling " + sources.mkString(" ") + "\noptions: " + opts0.mkString(" ")) - implicit val ctx: dotty.tools.dotc.core.Contexts.Context = { - val base = new dotty.tools.dotc.core.Contexts.ContextBase - base.initialCtx.fresh - } - try { val processor = if (opts0.exists(_.startsWith("#"))) dotty.tools.dotc.Bench else dotty.tools.dotc.Main val clogger = new ConsoleReporter(writer = clogWriter) - val logCtx = ctx.fresh.setTyperState(ctx.typerState.withReporter(clogger)) - val reporter = processor.process((sources.map(_.toString) ::: opts0).toArray, logCtx) + val reporter = processor.process((sources.map(_.toString) ::: opts0).toArray, clogger) if (!reporter.hasErrors) runner.genPass() else { - reporter.printSummary(ctx) + clogWriter.println(reporter.summary) runner.genFail(s"compilation failed with ${reporter.errorCount} errors") } } catch { -- cgit v1.2.3