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/backend | |
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/backend')
-rw-r--r-- | src/dotty/tools/backend/jvm/GenBCode.scala | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/dotty/tools/backend/jvm/GenBCode.scala b/src/dotty/tools/backend/jvm/GenBCode.scala index feaae036b..e8d196ce7 100644 --- a/src/dotty/tools/backend/jvm/GenBCode.scala +++ b/src/dotty/tools/backend/jvm/GenBCode.scala @@ -23,6 +23,7 @@ import Symbols._ import Denotations._ import Phases._ import java.lang.AssertionError +import java.io.{ File => JFile } import scala.tools.asm import scala.tools.asm.tree._ import dotty.tools.dotc.util.{Positions, DotClass} @@ -47,6 +48,8 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter var tree: Tree = _ + val sourceJFile: JFile = ctx.compilationUnit.source.file.file + final class PlainClassBuilder(cunit: CompilationUnit) extends SyncAndTryBuilder(cunit) @@ -300,6 +303,9 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter bytecodeWriter.close() // Statistics.stopTimer(BackendStats.bcodeTimer, bcodeStart) + if (ctx.compilerCallback != null) + ctx.compilerCallback.onSourceCompiled(sourceJFile) + /* TODO Bytecode can be verified (now that all classfiles have been written to disk) * * (1) asm.util.CheckAdapter.verify() @@ -363,6 +369,11 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter if (outFolder == null) null else getFileForClassfile(outFolder, jclassName, ".class") bytecodeWriter.writeClass(jclassName, jclassName, jclassBytes, outFile) + + val outJFile = outFile.file + val className = jclassName.replace('/', '.') + if (ctx.compilerCallback != null) + ctx.compilerCallback.onClassGenerated(sourceJFile, outJFile, className) } catch { case e: FileConflictException => |