aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/pickling/TreePickler.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-04-04 19:53:31 +0200
committerMartin Odersky <odersky@gmail.com>2015-04-07 23:53:58 +0200
commit6d2a2b1dede589c2d3b183d5ac109cab9100d618 (patch)
treef31770e3241d0cd9dd8559e75fd4daa14544ca52 /src/dotty/tools/dotc/core/pickling/TreePickler.scala
parentaf90fc5dd6606992763206929596bbcb6d5cba3c (diff)
downloaddotty-6d2a2b1dede589c2d3b183d5ac109cab9100d618.tar.gz
dotty-6d2a2b1dede589c2d3b183d5ac109cab9100d618.tar.bz2
dotty-6d2a2b1dede589c2d3b183d5ac109cab9100d618.zip
Produce expanded names.
In the absence of semantic names, this is kludgey. But we need to do it because otherwise the ExpandedName flag is not correctly set.
Diffstat (limited to 'src/dotty/tools/dotc/core/pickling/TreePickler.scala')
-rw-r--r--src/dotty/tools/dotc/core/pickling/TreePickler.scala15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/core/pickling/TreePickler.scala b/src/dotty/tools/dotc/core/pickling/TreePickler.scala
index c5e07ffa9..14a92e8e6 100644
--- a/src/dotty/tools/dotc/core/pickling/TreePickler.scala
+++ b/src/dotty/tools/dotc/core/pickling/TreePickler.scala
@@ -8,6 +8,7 @@ import PickleFormat._
import core._
import Contexts._, Symbols._, Types._, Names._, Constants._, Decorators._, Annotations._, StdNames.tpnme, NameOps._
import collection.mutable
+import NameOps._
import TastyBuffer._
class TreePickler(pickler: TastyPickler) {
@@ -61,13 +62,19 @@ class TreePickler(pickler: TastyPickler) {
}
}
- private def pickleName(name: Name) = writeNat(nameIndex(name).index)
- private def pickleName(name: TastyName) = writeNat(nameIndex(name).index)
+ private def pickleName(name: Name): Unit = writeNat(nameIndex(name).index)
+ private def pickleName(name: TastyName): Unit = writeNat(nameIndex(name).index)
private def pickleNameAndSig(name: Name, sig: Signature) = {
val Signature(params, result) = sig
pickleName(TastyName.Signed(nameIndex(name), params.map(fullNameIndex), fullNameIndex(result)))
}
-
+
+ private def pickleName(sym: Symbol)(implicit ctx: Context): Unit =
+ if (sym is Flags.ExpandedName)
+ pickleName(TastyName.Expanded(
+ nameIndex(sym.name.expandedPrefix), nameIndex(sym.name.unexpandedName)))
+ else pickleName(sym.name)
+
private def pickleSymRef(sym: Symbol)(implicit ctx: Context) = symRefs.get(sym) match {
case Some(label) =>
if (label != NoAddr) writeRef(label) else pickleForwardSymRef(sym)
@@ -464,7 +471,7 @@ class TreePickler(pickler: TastyPickler) {
registerDef(sym)
writeByte(tag)
withLength {
- pickleName(sym.name)
+ pickleName(sym)
pickleParams
tpt match {
case tpt: TypeTree => pickleTpt(tpt)