File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -398,19 +398,30 @@ object Symbols {
398
398
399
399
/** The last denotation of this symbol */
400
400
private [this ] var lastDenot : SymDenotation = _
401
+ private [this ] var checkedPeriod : Period = Nowhere
401
402
402
403
/** Set the denotation of this symbol */
403
- private [core] def denot_= (d : SymDenotation ) =
404
+ private [core] def denot_= (d : SymDenotation ) = {
404
405
lastDenot = d
406
+ checkedPeriod = Nowhere
407
+ }
405
408
406
409
/** The current denotation of this symbol */
407
410
final def denot (implicit ctx : Context ): SymDenotation = {
408
- var denot = lastDenot
409
- if (! (denot.validFor contains ctx.period)) {
410
- denot = denot.current.asInstanceOf [SymDenotation ]
411
- lastDenot = denot
411
+ val lastd = lastDenot
412
+ if (checkedPeriod == ctx.period) lastd
413
+ else computeDenot(lastd)
414
+ }
415
+
416
+ private def computeDenot (lastd : SymDenotation )(implicit ctx : Context ): SymDenotation = {
417
+ val now = ctx.period
418
+ checkedPeriod = now
419
+ if (lastd.validFor contains now) lastd
420
+ else {
421
+ val newd = lastd.current.asInstanceOf [SymDenotation ]
422
+ lastDenot = newd
423
+ newd
412
424
}
413
- denot
414
425
}
415
426
416
427
/** The initial denotation of this symbol, without going through `current` */
You can’t perform that action at this time.
0 commit comments