@@ -71,15 +71,12 @@ class TreePickler(pickler: TastyPickler) {
71
71
case _ =>
72
72
}
73
73
74
- def registerDef (sym : Symbol ): Unit = {
74
+ def registerDef (sym : Symbol ): Unit =
75
75
symRefs(sym) = currentAddr
76
- forwardSymRefs.get(sym) match {
77
- case Some (refs) =>
78
- refs.foreach(fillRef(_, currentAddr, relative = false ))
79
- forwardSymRefs -= sym
80
- case None =>
81
- }
82
- }
76
+ val refs = forwardSymRefs.lookup(sym)
77
+ if refs != null then
78
+ refs.foreach(fillRef(_, currentAddr, relative = false ))
79
+ forwardSymRefs -= sym
83
80
84
81
def pickleName (name : Name ): Unit = writeNat(nameIndex(name).index)
85
82
@@ -88,17 +85,19 @@ class TreePickler(pickler: TastyPickler) {
88
85
if (sig eq Signature .NotAMethod ) name
89
86
else SignedName (name.toTermName, sig, target.asTermName))
90
87
91
- private def pickleSymRef (sym : Symbol )(using Context ) = symRefs.get(sym) match {
92
- case Some (label) =>
93
- if (label != NoAddr ) writeRef(label) else pickleForwardSymRef(sym)
94
- case None =>
88
+ private def pickleSymRef (sym : Symbol )(using Context ) =
89
+ val label : Addr | Null = symRefs.lookup(sym)
90
+ if label == null then
95
91
// See pos/t1957.scala for an example where this can happen.
96
92
// I believe it's a bug in typer: the type of an implicit argument refers
97
93
// to a closure parameter outside the closure itself. TODO: track this down, so that we
98
94
// can eliminate this case.
99
95
report.log(i " pickling reference to as yet undefined $sym in ${sym.owner}" , sym.srcPos)
100
96
pickleForwardSymRef(sym)
101
- }
97
+ else if label == NoAddr then
98
+ pickleForwardSymRef(sym)
99
+ else
100
+ writeRef(label.uncheckedNN) // !!! Dotty problem: Not clear why nn or uncheckedNN is needed here
102
101
103
102
private def pickleForwardSymRef (sym : Symbol )(using Context ) = {
104
103
val ref = reserveRef(relative = false )
@@ -351,11 +350,10 @@ class TreePickler(pickler: TastyPickler) {
351
350
throw ex
352
351
if sym.is(Method ) && sym.owner.isClass then
353
352
profile.recordMethodSize(sym, currentAddr.index - addr.index, mdef.span)
354
- for
355
- docCtx <- ctx.docCtx
356
- comment <- docCtx.docstring(sym)
357
- do
358
- docStrings(mdef) = comment
353
+ for docCtx <- ctx.docCtx do
354
+ val comment = docCtx.docstrings.lookup(sym)
355
+ if comment != null then
356
+ docStrings(mdef) = comment
359
357
}
360
358
361
359
def pickleParam (tree : Tree )(using Context ): Unit = {
0 commit comments