aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/transform/Pickler.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-04-09 11:16:10 +0200
committerMartin Odersky <odersky@gmail.com>2016-04-09 11:16:10 +0200
commit5aa59ac17e6f48719f8b52048e0b86570e9399e3 (patch)
tree2c15394b99d4abb7e6adb71b63a0a8335c72d76a /src/dotty/tools/dotc/transform/Pickler.scala
parentf9d27c9f63ed1852b372757aadc517ec02cb17ff (diff)
downloaddotty-5aa59ac17e6f48719f8b52048e0b86570e9399e3.tar.gz
dotty-5aa59ac17e6f48719f8b52048e0b86570e9399e3.tar.bz2
dotty-5aa59ac17e6f48719f8b52048e0b86570e9399e3.zip
Simplify handling of sourcefiles in Tasty info
Instead of separate source file sections, pickle SourceFile as an annotation of all toplevel classes. We represent it like this anyway when reading back Tasty-defined classes.
Diffstat (limited to 'src/dotty/tools/dotc/transform/Pickler.scala')
-rw-r--r--src/dotty/tools/dotc/transform/Pickler.scala17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/dotty/tools/dotc/transform/Pickler.scala b/src/dotty/tools/dotc/transform/Pickler.scala
index c5b223d53..e8d6d03bf 100644
--- a/src/dotty/tools/dotc/transform/Pickler.scala
+++ b/src/dotty/tools/dotc/transform/Pickler.scala
@@ -11,7 +11,6 @@ import Periods._
import Phases._
import Symbols._
import Flags.Module
-import util.SourceFile
import collection.mutable
/** This phase pickles trees */
@@ -48,8 +47,6 @@ class Pickler extends Phase {
treePkl.pickle(tree :: Nil)
pickler.addrOfTree = treePkl.buf.addrOfTree
pickler.addrOfSym = treePkl.addrOfSym
- if (unit.source.exists)
- pickleSourcefile(pickler, unit.source)
if (tree.pos.exists)
new PositionPickler(pickler, treePkl.buf.addrOfTree).picklePositions(tree :: Nil, tree.pos)
@@ -65,12 +62,6 @@ class Pickler extends Phase {
}
}
- private def pickleSourcefile(pickler: TastyPickler, source: SourceFile): Unit = {
- val buf = new TastyBuffer(10)
- pickler.newSection("Sourcefile", buf)
- buf.writeNat(pickler.nameBuffer.nameIndex(source.file.path).index)
- }
-
override def runOn(units: List[CompilationUnit])(implicit ctx: Context): List[CompilationUnit] = {
val result = super.runOn(units)
if (ctx.settings.YtestPickler.value)
@@ -89,16 +80,16 @@ class Pickler extends Phase {
}
pickling.println("************* entered toplevel ***********")
for ((cls, unpickler) <- unpicklers) {
- val (unpickled, source) = unpickler.body(readPositions = true)
- testSame(i"$unpickled%\n%", beforePickling(cls), cls, source)
+ val unpickled = unpickler.body(readPositions = true)
+ testSame(i"$unpickled%\n%", beforePickling(cls), cls)
}
}
- private def testSame(unpickled: String, previous: String, cls: ClassSymbol, source: SourceFile)(implicit ctx: Context) =
+ private def testSame(unpickled: String, previous: String, cls: ClassSymbol)(implicit ctx: Context) =
if (previous != unpickled) {
output("before-pickling.txt", previous)
output("after-pickling.txt", unpickled)
- ctx.error(s"""pickling difference for ${cls.fullName} in $source, for details:
+ ctx.error(s"""pickling difference for ${cls.fullName} in ${cls.sourceFile}, for details:
|
| diff before-pickling.txt after-pickling.txt""".stripMargin)
}