@@ -468,7 +468,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
468
468
// if (isModuleRoot) println(s"moduleRoot of $moduleRoot found at $readIndex, flags = ${flags.flagsString}") // !!! DEBUG
469
469
// if (isModuleClassRoot) println(s"moduleClassRoot of $moduleClassRoot found at $readIndex, flags = ${flags.flagsString}") // !!! DEBUG
470
470
471
- def completeRoot (denot : ClassDenotation , completer : LazyType ): Symbol = {
471
+ def completeRoot (denot : ClassDenotation , completer : LazyType , privateWithin : Symbol ): Symbol = {
472
472
denot.setFlag(flags)
473
473
denot.resetFlag(Touched ) // allow one more completion
474
474
@@ -479,6 +479,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
479
479
if (owner == defn.ScalaPackageClass && ((name eq tpnme.Serializable ) || (name eq tpnme.Product )))
480
480
denot.setFlag(NoInits )
481
481
482
+ denot.privateWithin = privateWithin
482
483
denot.info = completer
483
484
denot.symbol
484
485
}
@@ -497,24 +498,32 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
497
498
sym
498
499
}
499
500
501
+ val (privateWithin, infoRef) = {
502
+ val ref = readNat()
503
+ if (! isSymbolRef(ref))
504
+ (NoSymbol , ref)
505
+ else {
506
+ val pw = at(ref, () => readSymbol())
507
+ (pw, readNat())
508
+ }
509
+ }
510
+
500
511
finishSym(tag match {
501
512
case TYPEsym | ALIASsym =>
502
513
var name1 = name.asTypeName
503
514
var flags1 = flags
504
515
if (flags.is(TypeParam )) flags1 |= owner.typeParamCreationFlags
505
- ctx.newSymbol(owner, name1, flags1, localMemberUnpickler, coord = start)
516
+ ctx.newSymbol(owner, name1, flags1, localMemberUnpickler, privateWithin, coord = start)
506
517
case CLASSsym =>
507
- var infoRef = readNat()
508
- if (isSymbolRef(infoRef)) infoRef = readNat()
509
518
if (isClassRoot)
510
519
completeRoot(
511
- classRoot, rootClassUnpickler(start, classRoot.symbol, NoSymbol , infoRef))
520
+ classRoot, rootClassUnpickler(start, classRoot.symbol, NoSymbol , infoRef), privateWithin )
512
521
else if (isModuleClassRoot)
513
522
completeRoot(
514
- moduleClassRoot, rootClassUnpickler(start, moduleClassRoot.symbol, moduleClassRoot.sourceModule, infoRef))
523
+ moduleClassRoot, rootClassUnpickler(start, moduleClassRoot.symbol, moduleClassRoot.sourceModule, infoRef), privateWithin )
515
524
else if (name == tpnme.REFINE_CLASS )
516
525
// create a type alias instead
517
- ctx.newSymbol(owner, name, flags, localMemberUnpickler, coord = start)
526
+ ctx.newSymbol(owner, name, flags, localMemberUnpickler, privateWithin, coord = start)
518
527
else {
519
528
def completer (cls : Symbol ) = {
520
529
val unpickler = new ClassUnpickler (infoRef) withDecls symScope(cls)
@@ -524,10 +533,10 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
524
533
.suchThat(_.is(Module )).symbol)
525
534
else unpickler
526
535
}
527
- ctx.newClassSymbol(owner, name.asTypeName, flags, completer, coord = start)
536
+ ctx.newClassSymbol(owner, name.asTypeName, flags, completer, privateWithin, coord = start)
528
537
}
529
538
case VALsym =>
530
- ctx.newSymbol(owner, name.asTermName, flags, localMemberUnpickler, coord = start)
539
+ ctx.newSymbol(owner, name.asTermName, flags, localMemberUnpickler, privateWithin, coord = start)
531
540
case MODULEsym =>
532
541
if (isModuleRoot) {
533
542
moduleRoot setFlag flags
@@ -536,7 +545,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
536
545
new LocalUnpickler () withModuleClass(implicit ctx =>
537
546
owner.info.decls.lookup(name.moduleClassName)
538
547
.suchThat(_.is(Module )).symbol)
539
- , coord = start)
548
+ , privateWithin, coord = start)
540
549
case _ =>
541
550
errorBadSignature(" bad symbol tag: " + tag)
542
551
})
@@ -552,16 +561,13 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
552
561
val unusedNameref = readNat()
553
562
val unusedOwnerref = readNat()
554
563
val unusedFlags = readLongNat()
564
+
555
565
var inforef = readNat()
556
- denot.privateWithin =
557
- if (! isSymbolRef(inforef)) NoSymbol
558
- else {
559
- val pw = at(inforef, () => readSymbol())
560
- inforef = readNat()
561
- pw
562
- }
566
+ if (isSymbolRef(inforef)) inforef = readNat()
567
+
563
568
// println("reading type for " + denot) // !!! DEBUG
564
569
val tp = at(inforef, () => readType()(ctx))
570
+
565
571
denot match {
566
572
case denot : ClassDenotation =>
567
573
val selfInfo = if (atEnd) NoType else readTypeRef()
0 commit comments