@@ -513,7 +513,7 @@ class TreeUnpickler(reader: TastyReader,
513
513
val rhsStart = currentAddr
514
514
val rhsIsEmpty = nothingButMods(end)
515
515
if (! rhsIsEmpty) skipTree()
516
- val (givenFlags, annots , privateWithin) = readModifiers(end)
516
+ val (givenFlags, annotFns , privateWithin) = readModifiers(end)
517
517
pickling.println(i " creating symbol $name at $start with flags $givenFlags" )
518
518
val flags = normalizeFlags(tag, givenFlags, name, isAbsType, rhsIsEmpty)
519
519
def adjustIfModule (completer : LazyType ) =
@@ -532,13 +532,12 @@ class TreeUnpickler(reader: TastyReader,
532
532
rootd.symbol
533
533
case _ =>
534
534
val completer = adjustIfModule(new Completer (ctx.owner, subReader(start, end)))
535
-
536
535
if (isClass)
537
536
ctx.newClassSymbol(ctx.owner, name.asTypeName, flags, completer, privateWithin, coord)
538
537
else
539
538
ctx.newSymbol(ctx.owner, name, flags, completer, privateWithin, coord)
540
539
}
541
- sym.annotations = annots
540
+ sym.annotations = annotFns.map(_(sym))
542
541
ctx.owner match {
543
542
case cls : ClassSymbol => cls.enter(sym)
544
543
case _ =>
@@ -548,7 +547,7 @@ class TreeUnpickler(reader: TastyReader,
548
547
sym.completer.withDecls(newScope)
549
548
forkAt(templateStart).indexTemplateParams()(localContext(sym))
550
549
}
551
- else if (sym.isInlineMethod )
550
+ else if (sym.isInlineableMethod )
552
551
sym.addAnnotation(LazyBodyAnnotation { ctx0 =>
553
552
implicit val ctx : Context = localContext(sym)(ctx0).addMode(Mode .ReadPositions )
554
553
// avoids space leaks by not capturing the current context
@@ -561,9 +560,9 @@ class TreeUnpickler(reader: TastyReader,
561
560
/** Read modifier list into triplet of flags, annotations and a privateWithin
562
561
* boundary symbol.
563
562
*/
564
- def readModifiers (end : Addr )(implicit ctx : Context ): (FlagSet , List [Annotation ], Symbol ) = {
563
+ def readModifiers (end : Addr )(implicit ctx : Context ): (FlagSet , List [Symbol => Annotation ], Symbol ) = {
565
564
var flags : FlagSet = EmptyFlags
566
- var annots : List [Annotation ] = Nil
565
+ var annotFns : List [Symbol => Annotation ] = Nil
567
566
var privateWithin : Symbol = NoSymbol
568
567
while (currentAddr.index != end.index) {
569
568
def addFlag (flag : FlagSet ) = {
@@ -588,6 +587,7 @@ class TreeUnpickler(reader: TastyReader,
588
587
case LAZY => addFlag(Lazy )
589
588
case OVERRIDE => addFlag(Override )
590
589
case INLINE => addFlag(Inline )
590
+ case TRANSPARENT => addFlag(Transparent )
591
591
case MACRO => addFlag(Macro )
592
592
case STATIC => addFlag(JavaStatic )
593
593
case OBJECT => addFlag(Module )
@@ -614,23 +614,25 @@ class TreeUnpickler(reader: TastyReader,
614
614
addFlag(Protected )
615
615
privateWithin = readType().typeSymbol
616
616
case ANNOTATION =>
617
- annots = readAnnot(ctx) :: annots
617
+ annotFns = readAnnot(ctx) :: annotFns
618
618
case tag =>
619
619
assert(false , s " illegal modifier tag $tag at $currentAddr, end = $end" )
620
620
}
621
621
}
622
- (flags, annots .reverse, privateWithin)
622
+ (flags, annotFns .reverse, privateWithin)
623
623
}
624
624
625
- private val readAnnot : Context => Annotation = {
625
+ private val readAnnot : Context => Symbol => Annotation = {
626
626
implicit ctx =>
627
627
readByte()
628
628
val end = readEnd()
629
629
val tp = readType()
630
- val lazyAnnotTree = readLater(end, rdr => ctx => rdr.readTerm()(ctx))
631
- Annotation .deferredSymAndTree(
632
- implicit ctx => tp.typeSymbol,
633
- implicit ctx => lazyAnnotTree.complete)
630
+ val lazyAnnotTree = readLaterWithOwner(end, rdr => ctx => rdr.readTerm()(ctx))
631
+
632
+ owner =>
633
+ Annotation .deferredSymAndTree(
634
+ implicit ctx => tp.typeSymbol,
635
+ implicit ctx => lazyAnnotTree(owner).complete)
634
636
}
635
637
636
638
/** Create symbols for the definitions in the statement sequence between
@@ -1153,10 +1155,13 @@ class TreeUnpickler(reader: TastyReader,
1153
1155
setPos(start, CaseDef (pat, guard, rhs))
1154
1156
}
1155
1157
1156
- def readLater [T <: AnyRef ](end : Addr , op : TreeReader => Context => T )(implicit ctx : Context ): Trees .Lazy [T ] = {
1158
+ def readLater [T <: AnyRef ](end : Addr , op : TreeReader => Context => T )(implicit ctx : Context ): Trees .Lazy [T ] =
1159
+ readLaterWithOwner(end, op)(ctx)(ctx.owner)
1160
+
1161
+ def readLaterWithOwner [T <: AnyRef ](end : Addr , op : TreeReader => Context => T )(implicit ctx : Context ): Symbol => Trees .Lazy [T ] = {
1157
1162
val localReader = fork
1158
1163
goto(end)
1159
- new LazyReader (localReader, ctx. owner, ctx.mode, op)
1164
+ owner => new LazyReader (localReader, owner, ctx.mode, op)
1160
1165
}
1161
1166
1162
1167
def readHole (end : Addr , isType : Boolean )(implicit ctx : Context ): Tree = {
0 commit comments