Skip to content

Commit 57d7dde

Browse files
committed
Convert TreeUnpickler context functions to CFTs (1)
1 parent 7edab06 commit 57d7dde

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ class TreeUnpickler(reader: TastyReader,
608608
* boundary symbol.
609609
*/
610610
def readModifiers[WithinType, AnnotType]
611-
(end: Addr, readAnnot: Context => Symbol => AnnotType, readWithin: Context => WithinType, defaultWithin: WithinType)
611+
(end: Addr, readAnnot: Context ?=> Symbol => AnnotType, readWithin: Context ?=> WithinType, defaultWithin: WithinType)
612612
(using Context): (FlagSet, List[Symbol => AnnotType], WithinType) = {
613613
var flags: FlagSet = EmptyFlags
614614
var annotFns: List[Symbol => AnnotType] = Nil
@@ -662,32 +662,28 @@ class TreeUnpickler(reader: TastyReader,
662662
case OPEN => addFlag(Open)
663663
case PRIVATEqualified =>
664664
readByte()
665-
privateWithin = readWithin(ctx)
665+
privateWithin = readWithin
666666
case PROTECTEDqualified =>
667667
addFlag(Protected)
668-
privateWithin = readWithin(ctx)
668+
privateWithin = readWithin
669669
case ANNOTATION =>
670-
annotFns = readAnnot(ctx) :: annotFns
670+
annotFns = readAnnot :: annotFns
671671
case tag =>
672672
assert(false, s"illegal modifier tag $tag at $currentAddr, end = $end")
673673
}
674674
}
675675
(flags, annotFns.reverse, privateWithin)
676676
}
677677

678-
private val readTypedWithin: Context => Symbol =
679-
implicit ctx => readType().typeSymbol
678+
private val readTypedWithin: Context ?=> Symbol = readType().typeSymbol
680679

681-
private val readTypedAnnot: Context => Symbol => Annotation = {
682-
implicit ctx =>
683-
readByte()
684-
val end = readEnd()
685-
val tp = readType()
686-
val lazyAnnotTree = readLaterWithOwner(end, rdr => implicit ctx => rdr.readTerm())
687-
688-
owner =>
689-
Annotation.deferredSymAndTree(tp.typeSymbol)(lazyAnnotTree(owner).complete)
690-
}
680+
private val readTypedAnnot: Context ?=> Symbol => Annotation =
681+
readByte()
682+
val end = readEnd()
683+
val tp = readType()
684+
val lazyAnnotTree = readLaterWithOwner(end, rdr => implicit ctx => rdr.readTerm())
685+
owner =>
686+
Annotation.deferredSymAndTree(tp.typeSymbol)(lazyAnnotTree(owner).complete)
691687

692688
/** Create symbols for the definitions in the statement sequence between
693689
* current address and `end`.

0 commit comments

Comments
 (0)