summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/backend/jvm/GenBCode.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2015-06-28 23:10:12 +1000
committerJason Zaugg <jzaugg@gmail.com>2015-06-28 23:17:19 +1000
commitb17a291c2edf28aca1713aa4a30d8bba3886bc8d (patch)
treebc76e4b01f8d2dc478ab57e9c79acbb44c1719cb /src/compiler/scala/tools/nsc/backend/jvm/GenBCode.scala
parent950bb26cdcc3913c1524faaf283b6090b6d83e67 (diff)
downloadscala-b17a291c2edf28aca1713aa4a30d8bba3886bc8d.tar.gz
scala-b17a291c2edf28aca1713aa4a30d8bba3886bc8d.tar.bz2
scala-b17a291c2edf28aca1713aa4a30d8bba3886bc8d.zip
GenBCode: fix incrementatal compilation by mimicing GenASM
The incremental compiler in SBT uses an implementation detail of the compiler backend to enumerate the classes that are actually written to disk. This commit mimics this in GenBCode by populating `Run#icode` with an `IClass` for each `ClassDef` processed. We should revisit this by creating a dedicated API for this purpose and migrating SBT to use that. We should also revisit this code as we implement closure elimination in the GenBCode; this commit assumes that all `ClassDef`s that enter the backend will generate classfile products. The enclosed test is extracted from the incrementatl compiler. I've also manually integration tested this with SBT: https://gist.github.com/retronym/fabf6f92787ea9c1ce67
Diffstat (limited to 'src/compiler/scala/tools/nsc/backend/jvm/GenBCode.scala')
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/GenBCode.scala5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenBCode.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenBCode.scala
index 455117d837..af962c4ce0 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/GenBCode.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/GenBCode.scala
@@ -167,6 +167,11 @@ abstract class GenBCode extends BCodeSyncAndTry {
)
}
+ // shim for SBT, see https://github.com/sbt/sbt/issues/2076
+ // TODO put this closer to classfile writing once we have closure elimination
+ // TODO create a nicer public API to find out the correspondence between sourcefile and ultimate classfiles
+ currentUnit.icode += new icodes.IClass(cd.symbol)
+
// -------------- mirror class, if needed --------------
val mirrorC =
if (isTopLevelModuleClass(claszSymbol)) {