diff options
author | Martin Odersky <odersky@gmail.com> | 2017-03-24 19:15:51 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2017-04-11 09:33:10 +0200 |
commit | 0755ec28d22798c51aedf45e4dcdf1ed299c2aa5 (patch) | |
tree | 06b8b8f94005a9380d76c42880239fe282be268b /compiler/src/dotty/tools/dotc/core/tasty | |
parent | 0ad1cd816bc1537ad332addabb0ff6c293e3e0a0 (diff) | |
download | dotty-0755ec28d22798c51aedf45e4dcdf1ed299c2aa5.tar.gz dotty-0755ec28d22798c51aedf45e4dcdf1ed299c2aa5.tar.bz2 dotty-0755ec28d22798c51aedf45e4dcdf1ed299c2aa5.zip |
Add Variant NameInfo
Plus further bug fixes.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core/tasty')
6 files changed, 15 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/tasty/NameBuffer.scala b/compiler/src/dotty/tools/dotc/core/tasty/NameBuffer.scala index b45255eb8..19eb731c7 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/NameBuffer.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/NameBuffer.scala @@ -38,6 +38,8 @@ class NameBuffer extends TastyBuffer(10000) { tcon(nameIndex(prefix, toTasty), nameIndex(qual.name)) case DerivedTermName(prefix, NameInfo.DefaultGetter(num)) => DefaultGetter(nameIndex(prefix, toTasty), num) + case DerivedTermName(prefix, NameInfo.Variant(sign)) => + Variant(nameIndex(prefix, toTasty), sign) case name1 => if (name1.isShadowedName) Shadowed(nameIndex(name1.revertShadowed, toTasty)) else toTasty(name1.asSimpleName) @@ -102,6 +104,9 @@ class NameBuffer extends TastyBuffer(10000) { case Shadowed(original) => writeByte(SHADOWED) withLength { writeNameRef(original) } + case Variant(original, sign) => + writeByte(VARIANT) + withLength { writeNameRef(original); writeNat(sign + 1) } } override def assemble(): Unit = { diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TastyFormat.scala b/compiler/src/dotty/tools/dotc/core/tasty/TastyFormat.scala index 848b7995f..d4f6782fb 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TastyFormat.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TastyFormat.scala @@ -229,6 +229,7 @@ object TastyFormat { final val SUPERACCESSOR = 7 final val DEFAULTGETTER = 8 final val SHADOWED = 9 + final val VARIANT = 10 // AST tags @@ -412,11 +413,14 @@ object TastyFormat { def nameTagToString(tag: Int): String = tag match { case UTF8 => "UTF8" case QUALIFIED => "QUALIFIED" - case SIGNED => "SIGNED" + case FLATTENED => "FLATTENED" case EXPANDED => "EXPANDED" + case SIGNED => "SIGNED" case OBJECTCLASS => "OBJECTCLASS" case SUPERACCESSOR => "SUPERACCESSOR" case DEFAULTGETTER => "DEFAULTGETTER" + case SHADOWED => "SHADOWED" + case VARIANT => "VARIANT" } def astTagToString(tag: Int): String = tag match { diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TastyName.scala b/compiler/src/dotty/tools/dotc/core/tasty/TastyName.scala index 67b08a1c1..769ecfbfc 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TastyName.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TastyName.scala @@ -21,6 +21,7 @@ object TastyName { case class SuperAccessor(accessed: NameRef) extends TastyName case class DefaultGetter(method: NameRef, num: Int) extends TastyName case class Shadowed(original: NameRef) extends TastyName + case class Variant(original: NameRef, sign: Int) extends TastyName class Table extends (NameRef => TastyName) { private val names = new mutable.ArrayBuffer[TastyName] diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TastyUnpickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TastyUnpickler.scala index c8c1878bc..e6b43e6b4 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TastyUnpickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TastyUnpickler.scala @@ -62,6 +62,8 @@ class TastyUnpickler(reader: TastyReader) { DefaultGetter(readNameRef(), readNat()) case SHADOWED => Shadowed(readNameRef()) + case VARIANT => + Variant(readNameRef(), readNat() - 1) } assert(currentAddr == end, s"bad name $result $start $currentAddr $end") result diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala index 78d59c99f..d81bd3ea8 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala @@ -13,6 +13,7 @@ import NameOps._ import StdNames.nme import TastyBuffer._ import TypeApplications._ +import config.Config class TreePickler(pickler: TastyPickler) { val buf = new TreeBuffer diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala index d4269d6e4..14c3d7cd1 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala @@ -91,6 +91,7 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table, posUnpickle case ModuleClass(original) => toTermName(original).moduleClassName.toTermName case SuperAccessor(accessed) => toTermName(accessed).superName case DefaultGetter(meth, num) => toTermName(meth).defaultGetterName(num) + case Variant(original, sign) => toTermName(original).derived(NameInfo.Variant(sign)) } private def qualTermName(qual: NameRef, name: NameRef, sep: String) = |