@@ -194,9 +194,6 @@ object Denotations {
194
194
*/
195
195
def infoOrCompleter : Type
196
196
197
- /** The period during which this denotation is valid. */
198
- def validFor : Period
199
-
200
197
/** Is this a reference to a type symbol? */
201
198
def isType : Boolean
202
199
@@ -229,6 +226,15 @@ object Denotations {
229
226
*/
230
227
def current (using Context ): Denotation
231
228
229
+ /** The period during which this denotation is valid. */
230
+ private var myValidFor : Period = Nowhere
231
+
232
+ final def validFor : Period = myValidFor
233
+ final def validFor_= (p : Period ): Unit = {
234
+ myValidFor = p
235
+ symbol.invalidateDenotCache()
236
+ }
237
+
232
238
/** Is this denotation different from NoDenotation or an ErrorDenotation? */
233
239
def exists : Boolean = true
234
240
@@ -667,14 +673,6 @@ object Denotations {
667
673
668
674
// ------ Transformations -----------------------------------------
669
675
670
- private var myValidFor : Period = Nowhere
671
-
672
- def validFor : Period = myValidFor
673
- def validFor_= (p : Period ): Unit = {
674
- myValidFor = p
675
- symbol.invalidateDenotCache()
676
- }
677
-
678
676
/** The next SingleDenotation in this run, with wrap-around from last to first.
679
677
*
680
678
* There may be several `SingleDenotation`s with different validity
@@ -698,7 +696,7 @@ object Denotations {
698
696
if (validFor.firstPhaseId <= 1 ) this
699
697
else {
700
698
var current = nextInRun
701
- while (current.validFor.code > this .myValidFor .code) current = current.nextInRun
699
+ while (current.validFor.code > this .validFor .code) current = current.nextInRun
702
700
current
703
701
}
704
702
@@ -779,7 +777,7 @@ object Denotations {
779
777
* are otherwise undefined.
780
778
*/
781
779
def skipRemoved (using Context ): SingleDenotation =
782
- if (myValidFor .code <= 0 ) nextDefined else this
780
+ if (validFor .code <= 0 ) nextDefined else this
783
781
784
782
/** Produce a denotation that is valid for the given context.
785
783
* Usually called when !(validFor contains ctx.period)
@@ -796,7 +794,7 @@ object Denotations {
796
794
def current (using Context ): SingleDenotation =
797
795
util.Stats .record(" current" )
798
796
val currentPeriod = ctx.period
799
- val valid = myValidFor
797
+ val valid = validFor
800
798
801
799
def assertNotPackage (d : SingleDenotation , transformer : DenotTransformer ) = d match
802
800
case d : ClassDenotation =>
@@ -833,7 +831,6 @@ object Denotations {
833
831
val savedPeriod = ctx.period
834
832
val mutCtx = ctx.asInstanceOf [FreshContext ]
835
833
try
836
- util.Stats .record(" current.transform" )
837
834
mutCtx.setPhase(transformer)
838
835
next = transformer.transform(cur)
839
836
// We temporarily update the context with the new phase instead of creating a
@@ -967,7 +964,7 @@ object Denotations {
967
964
case denot : SymDenotation => s " in ${denot.owner}"
968
965
case _ => " "
969
966
}
970
- s " stale symbol; $this# ${symbol.id} $ownerMsg, defined in ${myValidFor }, is referred to in run ${ctx.period}"
967
+ s " stale symbol; $this# ${symbol.id} $ownerMsg, defined in ${validFor }, is referred to in run ${ctx.period}"
971
968
}
972
969
973
970
/** The period (interval of phases) for which there exists
@@ -1252,8 +1249,9 @@ object Denotations {
1252
1249
/** An overloaded denotation consisting of the alternatives of both given denotations.
1253
1250
*/
1254
1251
case class MultiDenotation (denot1 : Denotation , denot2 : Denotation ) extends Denotation (NoSymbol , NoType ) with MultiPreDenotation {
1252
+ validFor = denot1.validFor & denot2.validFor
1253
+
1255
1254
final def infoOrCompleter : Type = multiHasNot(" info" )
1256
- final def validFor : Period = denot1.validFor & denot2.validFor
1257
1255
final def isType : Boolean = false
1258
1256
final def hasUniqueSym : Boolean = false
1259
1257
final def name (using Context ): Name = denot1.name
0 commit comments