diff options
author | Martin Odersky <odersky@gmail.com> | 2015-03-08 12:40:50 +0100 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-03-18 11:15:48 +0100 |
commit | d572ec04a29d4bb70dccd5b01e205233d496d24d (patch) | |
tree | bab32c90790c21fc97474dc238209e097b487202 /src/dotty/tools/dotc | |
parent | 78ef6bbe9da970afa0af9d086c305eb36db56b8b (diff) | |
download | dotty-d572ec04a29d4bb70dccd5b01e205233d496d24d.tar.gz dotty-d572ec04a29d4bb70dccd5b01e205233d496d24d.tar.bz2 dotty-d572ec04a29d4bb70dccd5b01e205233d496d24d.zip |
Pickle signatures using qualified names.
Would like to do use more semantic names in pickled file, but it's hard without
having semantic names to start with.
Diffstat (limited to 'src/dotty/tools/dotc')
-rw-r--r-- | src/dotty/tools/dotc/core/pickling/NameBuffer.scala | 8 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/pickling/TreePickler.scala | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/pickling/NameBuffer.scala b/src/dotty/tools/dotc/core/pickling/NameBuffer.scala index c72df5563..a102a5382 100644 --- a/src/dotty/tools/dotc/core/pickling/NameBuffer.scala +++ b/src/dotty/tools/dotc/core/pickling/NameBuffer.scala @@ -32,6 +32,14 @@ class NameBuffer extends TastyBuffer(100000) { def nameIndex(str: String): NameRef = nameIndex(str.toTermName) + def fullNameIndex(name: Name): NameRef = { + val pos = name.lastIndexOf('.') + if (pos > 0) + nameIndex(Qualified(fullNameIndex(name.take(pos)), nameIndex(name.drop(pos + 1)))) + else + nameIndex(name) + } + private def withLength(op: => Unit): Unit = { val lengthAddr = currentAddr writeByte(0) diff --git a/src/dotty/tools/dotc/core/pickling/TreePickler.scala b/src/dotty/tools/dotc/core/pickling/TreePickler.scala index 7ffcaec6e..3f21f3c2f 100644 --- a/src/dotty/tools/dotc/core/pickling/TreePickler.scala +++ b/src/dotty/tools/dotc/core/pickling/TreePickler.scala @@ -14,7 +14,7 @@ class TreePickler(pickler: TastyPickler) { val buf = new TreeBuffer pickler.newSection("ASTs", buf) import buf._ - import pickler.nameBuffer.nameIndex + import pickler.nameBuffer.{nameIndex, fullNameIndex} import ast.tpd._ private val symRefs = new mutable.HashMap[Symbol, Addr] @@ -61,7 +61,7 @@ class TreePickler(pickler: TastyPickler) { private def pickleName(name: TastyName) = writeNat(nameIndex(name).index) private def pickleNameAndSig(name: Name, sig: Signature) = { val Signature(params, result) = sig - pickleName(TastyName.Signed(nameIndex(name), params.map(nameIndex), nameIndex(result))) + pickleName(TastyName.Signed(nameIndex(name), params.map(fullNameIndex), fullNameIndex(result))) } private def pickleSymRef(sym: Symbol)(implicit ctx: Context) = symRefs.get(sym) match { |