aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-04-25 13:41:22 +0200
committerMartin Odersky <odersky@gmail.com>2015-04-25 13:41:44 +0200
commit8cec943e961c4d82c132855e56d1747cf968830b (patch)
tree93d23149c9c9ffaac331cee99535bdeb197c4c90 /src/dotty/tools/dotc/core/pickling/ClassfileParser.scala
parent7ebc9e2f74e5452749a39f9423de0ba4bd91d7c2 (diff)
downloaddotty-8cec943e961c4d82c132855e56d1747cf968830b.tar.gz
dotty-8cec943e961c4d82c132855e56d1747cf968830b.tar.bz2
dotty-8cec943e961c4d82c132855e56d1747cf968830b.zip
Allow separate compilation of Dotty using TASTY
Classfile parser now reads TASTY attributes or annotations and unpickles them in order to allow for separate compilation.
Diffstat (limited to 'src/dotty/tools/dotc/core/pickling/ClassfileParser.scala')
-rw-r--r--src/dotty/tools/dotc/core/pickling/ClassfileParser.scala29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala b/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala
index 3d47678b7..21c9aa84d 100644
--- a/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala
+++ b/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala
@@ -664,11 +664,17 @@ class ClassfileParser(
i < attrs
}
- def unpickle(bytes: Array[Byte]): Boolean = {
+ def unpickleScala(bytes: Array[Byte]): Boolean = {
new UnPickler(bytes, classRoot, moduleRoot)(ctx).run()
true
}
+ def unpickleTASTY(bytes: Array[Byte]): Boolean = {
+ new DottyUnpickler(bytes)
+ .enter(roots = Set(classRoot, moduleRoot, moduleRoot.sourceModule))
+ true
+ }
+
def parseScalaSigBytes: Array[Byte] = {
val tag = in.nextByte.toChar
assert(tag == STRING_TAG, tag)
@@ -688,6 +694,11 @@ class ClassfileParser(
pool.getBytes(entries.toList)
}
+ if (scan(tpnme.TASTYATTR)) {
+ val attrLen = in.nextInt
+ return unpickleTASTY(in.nextBytes(attrLen))
+ }
+
if (scan(tpnme.RuntimeAnnotationATTR)) {
val attrLen = in.nextInt
val nAnnots = in.nextChar
@@ -698,12 +709,16 @@ class ClassfileParser(
var j = 0
while (j < nArgs) {
val argName = pool.getName(in.nextChar)
- if (attrClass == defn.ScalaSignatureAnnot && argName == nme.bytes)
- return unpickle(parseScalaSigBytes)
- else if (attrClass == defn.ScalaLongSignatureAnnot && argName == nme.bytes)
- return unpickle(parseScalaLongSigBytes)
- else
- parseAnnotArg(skip = true)
+ if (argName == nme.bytes)
+ if (attrClass == defn.ScalaSignatureAnnot)
+ return unpickleScala(parseScalaSigBytes)
+ else if (attrClass == defn.ScalaLongSignatureAnnot)
+ return unpickleScala(parseScalaLongSigBytes)
+ else if (attrClass == defn.TASTYSignatureAnnot)
+ return unpickleTASTY(parseScalaSigBytes)
+ else if (attrClass == defn.TASTYLongSignatureAnnot)
+ return unpickleTASTY(parseScalaLongSigBytes)
+ parseAnnotArg(skip = true)
j += 1
}
i += 1