@@ -434,16 +434,12 @@ object Symbols {
434
434
private [this ] var lastDenot : SymDenotation = _
435
435
private [this ] var checkedPeriod : Period = Nowhere
436
436
437
- private [this ] var cachedValidFor : Period = _
438
437
private [this ] var cachedName : Name = _
439
438
private [this ] var cachedOwner : Symbol = _
440
439
private [this ] var cachedInfo : Type = _
441
440
private [this ] var cachedFlags : FlagSet = _
442
441
443
- private [core] def updateValidForCache (d : Denotation , validFor : Period ) = {
444
- if (lastDenot `eq` d) cachedValidFor = validFor
445
- checkedPeriod = Nowhere // this forces recomputeDenot() on next call to denot
446
- }
442
+ private [core] def invalidateDenotCache () = { checkedPeriod = Nowhere }
447
443
448
444
private [core] def updateInfoCache (d : SymDenotation , info : Type ) =
449
445
if (lastDenot `eq` d) cachedInfo = info
@@ -453,7 +449,6 @@ object Symbols {
453
449
454
450
private [this ] def setLastDenot (d : SymDenotation ) = {
455
451
lastDenot = d
456
- cachedValidFor = d.validFor
457
452
cachedName = d.name
458
453
cachedOwner = d.maybeOwner
459
454
cachedInfo = d.infoOrCompleter
@@ -469,21 +464,22 @@ object Symbols {
469
464
/** The current denotation of this symbol */
470
465
final def denot (implicit ctx : Context ): SymDenotation = {
471
466
Stats .record(" Symbol.denot" )
472
- if (checkedPeriod == ctx.period) lastDenot
473
- else computeDenot()
467
+ val lastd = lastDenot
468
+ if (checkedPeriod == ctx.period) lastd
469
+ else computeDenot(lastd)
474
470
}
475
471
476
- private def computeDenot ()(implicit ctx : Context ): SymDenotation = {
472
+ private def computeDenot (lastd : SymDenotation )(implicit ctx : Context ): SymDenotation = {
477
473
Stats .record(" Symbol.computeDenot" )
478
474
val now = ctx.period
479
475
checkedPeriod = now
480
- if (cachedValidFor contains now) lastDenot else recomputeDenot()
476
+ if (lastd.validFor contains now) lastd else recomputeDenot(lastd )
481
477
}
482
478
483
479
/** Overridden in NoSymbol */
484
- protected def recomputeDenot ()(implicit ctx : Context ) = {
480
+ protected def recomputeDenot (lastd : SymDenotation )(implicit ctx : Context ) = {
485
481
Stats .record(" Symbol.recomputeDenot" )
486
- val newd = lastDenot .current.asInstanceOf [SymDenotation ]
482
+ val newd = lastd .current.asInstanceOf [SymDenotation ]
487
483
setLastDenot(newd)
488
484
newd
489
485
}
@@ -642,7 +638,7 @@ object Symbols {
642
638
// -------- Cached SymDenotation facades -----------------------------------------------
643
639
644
640
private def ensureUpToDate ()(implicit ctx : Context ) =
645
- if (checkedPeriod != ctx.period) computeDenot()
641
+ if (checkedPeriod != ctx.period) computeDenot(lastDenot )
646
642
647
643
/** The current name of this symbol */
648
644
final def name (implicit ctx : Context ): ThisName = {
@@ -897,7 +893,7 @@ object Symbols {
897
893
@ sharable object NoSymbol extends Symbol (NoCoord , 0 ) {
898
894
override def owner (implicit ctx : Context ): Symbol = throw new AssertionError (" NoSymbol.owner" )
899
895
override def associatedFile (implicit ctx : Context ): AbstractFile = NoSource .file
900
- override def recomputeDenot ()(implicit ctx : Context ): SymDenotation = NoDenotation
896
+ override def recomputeDenot (lastd : SymDenotation )(implicit ctx : Context ): SymDenotation = NoDenotation
901
897
}
902
898
903
899
NoDenotation // force it in order to set `denot` field of NoSymbol
0 commit comments