@@ -19,6 +19,7 @@ import printing.Printer
19
19
import io .AbstractFile
20
20
import config .Config
21
21
import util .common ._
22
+ import collection .mutable .ListBuffer
22
23
import Decorators .SymbolIteratorDecorator
23
24
24
25
/** Denotations represent the meaning of symbols and named types.
@@ -459,7 +460,7 @@ object Denotations {
459
460
* 2) the union of all validity periods is a contiguous
460
461
* interval.
461
462
*/
462
- var nextInRun : SingleDenotation = this
463
+ private var nextInRun : SingleDenotation = this
463
464
464
465
/** The version of this SingleDenotation that was valid in the first phase
465
466
* of this run.
@@ -470,6 +471,17 @@ object Denotations {
470
471
current
471
472
}
472
473
474
+ def history : List [SingleDenotation ] = {
475
+ val b = new ListBuffer [SingleDenotation ]
476
+ var current = initial
477
+ do {
478
+ b += (current)
479
+ current = current.nextInRun
480
+ }
481
+ while (current ne initial)
482
+ b.toList
483
+ }
484
+
473
485
/** Move validity period of this denotation to a new run. Throw a StaleSymbol error
474
486
* if denotation is no longer valid.
475
487
*/
@@ -518,27 +530,30 @@ object Denotations {
518
530
cur = next
519
531
cur
520
532
} else {
533
+ // println(s"might need new denot for $cur, valid for ${cur.validFor} at $currentPeriod")
521
534
// not found, cur points to highest existing variant
522
- var startPid = cur.validFor.lastPhaseId + 1
523
- val nextTranformerId = ctx.nextDenotTransformerId(startPid)
524
- val transformer = ctx.denotTransformers(nextTranformerId)
525
- // println(s"transforming with $transformer")
526
- if (currentPeriod.lastPhaseId > transformer.id)
527
- next = transformer.transform(cur)(ctx.withPhase(startPid)).syncWithParents
528
- if (next eq cur)
529
- startPid = cur.validFor.firstPhaseId
535
+ val nextTransformerId = ctx.nextDenotTransformerId(cur.validFor.lastPhaseId)
536
+ if (currentPeriod.lastPhaseId <= nextTransformerId)
537
+ cur.validFor = Period (currentPeriod.runId, cur.validFor.firstPhaseId, nextTransformerId)
530
538
else {
531
- next match {
532
- case next : ClassDenotation => next.resetFlag(Frozen )
533
- case _ =>
539
+ var startPid = nextTransformerId + 1
540
+ val transformer = ctx.denotTransformers(nextTransformerId)
541
+ // println(s"transforming $this with $transformer")
542
+ next = transformer.transform(cur)(ctx.withPhase(transformer)).syncWithParents
543
+ if (next eq cur)
544
+ startPid = cur.validFor.firstPhaseId
545
+ else {
546
+ next match {
547
+ case next : ClassDenotation => next.resetFlag(Frozen )
548
+ case _ =>
549
+ }
550
+ next.nextInRun = cur.nextInRun
551
+ cur.nextInRun = next
552
+ cur = next
534
553
}
535
- next.nextInRun = cur.nextInRun
536
- cur.nextInRun = next
537
- cur = next
554
+ cur.validFor = Period (currentPeriod.runId, startPid, transformer.lastPhaseId)
555
+ // println(s"new denot: $cur, valid for ${cur.validFor}")
538
556
}
539
- cur.validFor = Period (
540
- currentPeriod.runId, startPid, transformer.lastPhaseId)
541
- // println(s"new denot: $cur, valid for ${cur.validFor}")
542
557
cur.current // multiple transformations could be required
543
558
}
544
559
} else {
@@ -562,7 +577,7 @@ object Denotations {
562
577
case denot : SymDenotation => s " in ${denot.owner}"
563
578
case _ => " "
564
579
}
565
- def msg = s " stale symbol; $this# ${symbol.id}$ownerMsg, defined in run ${myValidFor.runId}, is referred to in run ${ctx.period .runId}"
580
+ def msg = s " stale symbol; $this# ${symbol.id} $ownerMsg, defined in run ${myValidFor.runId}, is referred to in run ${ctx.runId}"
566
581
throw new StaleSymbol (msg)
567
582
}
568
583
0 commit comments