Skip to content

Commit 3ce6b85

Browse files
committed
delete dead code and comments, refactor
1 parent e638e34 commit 3ce6b85

12 files changed

+139
-854
lines changed

src/compiler/scala/tools/nsc/tasty/CommentUnpickler.scala

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/compiler/scala/tools/nsc/tasty/PositionUnpickler.scala

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/compiler/scala/tools/nsc/tasty/ScalacUnpickler.scala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ object ScalacUnpickler {
1212
final class TreeSectionUnpickler[Tasty <: TastyUniverse](implicit tasty: Tasty)
1313
extends SectionUnpickler[TreeUnpickler[Tasty]]("ASTs") { self =>
1414
def unpickle(reader: TastyReader, nameAtRef: NameRef => TastyName ): TreeUnpickler[Tasty] =
15-
new TreeUnpickler(reader, nameAtRef, None, None, Seq.empty)
15+
new TreeUnpickler(reader, nameAtRef, Seq.empty)
1616
}
1717

1818
object Unpickler {
@@ -38,9 +38,7 @@ object ScalacUnpickler {
3838

3939
val treeUnpickler = unpickler.unpickle[TreeUnpickler[tasty.type]](new TreeSectionUnpickler()(tasty)).get
4040

41-
implicit val ctx: Context = {
42-
new InitialContext(classRoot, mirrorThatLoaded(classRoot), AbstractFile.getFile(filename))
43-
}
41+
implicit val ctx: Context = new InitialContext(classRoot, AbstractFile.getFile(filename))
4442
treeUnpickler.enter(classRoot, moduleRoot)
4543
} catch {
4644
case NonFatal(ex) =>

src/compiler/scala/tools/nsc/tasty/TastyFormat.scala

Lines changed: 0 additions & 269 deletions
Large diffs are not rendered by default.

src/compiler/scala/tools/nsc/tasty/TastyUniverse.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ abstract class TastyUniverse extends TastyKernel
1010
with ContextOps
1111
with SymbolOps
1212
with NameOps
13-
with TreeOps

src/compiler/scala/tools/nsc/tasty/TastyUnpickler.scala

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package scala.tools.nsc.tasty
22

33
import scala.collection.mutable
44

5-
import TastyFormat.NameTags._, TastyFormat.nameTagToString
5+
import TastyFormat.NameTags._
66
import TastyRefs.NameRef
77
import Names.TastyName, Names.TastyName._
88

@@ -48,58 +48,46 @@ class TastyUnpickler(reader: TastyReader)(implicit tasty: TastyUniverse) { self
4848
val length = readNat()
4949
val start = currentAddr
5050
val end = start + length
51+
def debugName(name: TastyName): name.type = {
52+
logTasty(s"${nameAtRef.size}: ${name.debug}")
53+
name
54+
}
5155
val result = tag match {
5256
case UTF8 =>
5357
goto(end)
54-
val res = SimpleName(new String(bytes.slice(start.index, start.index + length), "UTF-8"))
55-
logTasty(s"${nameAtRef.size}: ${res.debug}")
56-
res
58+
debugName(SimpleName(new String(bytes.slice(start.index, start.index + length), "UTF-8")))
5759
case tag @ (QUALIFIED | EXPANDED | EXPANDPREFIX) =>
5860
val sep = tag match {
5961
case QUALIFIED => TastyName.PathSep
6062
case EXPANDED => TastyName.ExpandedSep
6163
case EXPANDPREFIX => TastyName.ExpandPrefixSep
6264
}
63-
val res = QualifiedName(readName(), sep, readName().asSimpleName)
64-
logTasty(s"${nameAtRef.size}: ${res.debug}")
65-
res // qualifiedNameKindOfTag(tag)(readName(), readName().asSimpleName)
65+
debugName(QualifiedName(readName(), sep, readName().asSimpleName))
6666
case UNIQUE =>
6767
val separator = readName().asSimpleName
68-
val num = readNat()
68+
val num = readNat()
6969
val originals = until(end)(readName())
7070
val original = if (originals.isEmpty) TastyName.Empty else originals.head
71-
val res = UniqueName(original, separator, num)
72-
logTasty(s"${nameAtRef.size}: ${res.debug}")
73-
res // uniqueNameKindOfSeparator(separator)(original, num)
71+
debugName(UniqueName(original, separator, num))
7472
case DEFAULTGETTER =>
75-
val qual = readName()
76-
val nat = readNat()
77-
val res = DefaultName(qual, nat)
78-
logTasty(s"${nameAtRef.size}: ${res.debug}")
79-
res // numberedNameKindOfTag(tag)(readName(), readNat())
73+
debugName(DefaultName(readName(), readNat()))
8074
case SIGNED =>
8175
val original = readName()
8276
val result = readName()
8377
val paramsSig = until(end)(readParamSig())
8478
val sig = Signature(paramsSig, result)
85-
val res = SignedName(original, sig)
86-
logTasty(s"${nameAtRef.size}: ${res.debug}")
87-
res
79+
debugName(SignedName(original, sig))
8880
case OBJECTCLASS =>
89-
val res = ModuleName(readName())
90-
logTasty(s"${nameAtRef.size}: ${res.debug}")
91-
res
81+
debugName(ModuleName(readName()))
9282
case INLINEACCESSOR | SUPERACCESSOR =>
9383
val prefix = tag match {
9484
case INLINEACCESSOR => TastyName.InlinePrefix
9585
case SUPERACCESSOR => TastyName.SuperPrefix
9686
}
97-
val res = PrefixName(prefix, readName())
98-
logTasty(s"${nameAtRef.size}: ${res.debug}")
99-
res
87+
debugName(PrefixName(prefix, readName()))
10088
case _ =>
101-
val qual = readName() // simpleNameKindOfTag(tag)(readName())
102-
sys.error(s"at Addr(${nameAtRef.size}): unknown ${nameTagToString(tag)} name: $qual")
89+
val qual = readName()
90+
sys.error(s"at NameRef(${nameAtRef.size}): name `${qual.debug}` is qualified by unknown tag $tag")
10391
}
10492
assert(currentAddr == end, s"bad name ${result.debug} $start $currentAddr $end")
10593
result

0 commit comments

Comments
 (0)