diff options
author | Guillaume Martres <smarter@ubuntu.com> | 2015-12-02 16:26:12 +0100 |
---|---|---|
committer | Guillaume Martres <smarter@ubuntu.com> | 2015-12-03 14:58:12 +0100 |
commit | ccf7f8ae4e09c1e5cbbc52d64ff0358203d29d5c (patch) | |
tree | 079ef70f2596fd65798164ce527fd8c204d34791 /src/dotty/tools/dotc/Driver.scala | |
parent | 47da63278147634c75ecd3d0b5f3709a8de2a2db (diff) | |
download | dotty-ccf7f8ae4e09c1e5cbbc52d64ff0358203d29d5c.tar.gz dotty-ccf7f8ae4e09c1e5cbbc52d64ff0358203d29d5c.tar.bz2 dotty-ccf7f8ae4e09c1e5cbbc52d64ff0358203d29d5c.zip |
Add initial CompilerCallback implementation for IntelliJ
This adds some simple callbacks to Dotty that should be enough to
get basic integration from IntelliJ.
Diffstat (limited to 'src/dotty/tools/dotc/Driver.scala')
-rw-r--r-- | src/dotty/tools/dotc/Driver.scala | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/Driver.scala b/src/dotty/tools/dotc/Driver.scala index 22170a478..1627b6e48 100644 --- a/src/dotty/tools/dotc/Driver.scala +++ b/src/dotty/tools/dotc/Driver.scala @@ -34,7 +34,10 @@ abstract class Driver extends DotClass { def setup(args: Array[String], rootCtx: Context): (List[String], Context) = { val summary = CompilerCommand.distill(args)(rootCtx) - implicit val ctx: Context = initCtx.fresh.setSettings(summary.sstate) + // FIXME: We should reuse rootCtx instead of creating newCtx, but this + // makes some tests fail with "denotation module _root_ invalid in run 2." + val newCtx = initCtx.setCompilerCallback(rootCtx.compilerCallback) + implicit val ctx: Context = newCtx.fresh.setSettings(summary.sstate) val fileNames = CompilerCommand.checkUsage(summary, sourcesRequired) (fileNames, ctx) } @@ -44,6 +47,10 @@ abstract class Driver extends DotClass { doCompile(newCompiler(), fileNames)(ctx) } + def process(args: Array[String], callback: CompilerCallback): Reporter = { + process(args, initCtx.setCompilerCallback(callback)) + } + // We overload `process` instead of using a default argument so that we // can easily call this method using reflection from `RawCompiler` in sbt. def process(args: Array[String]): Reporter = { |