diff options
author | Martin Odersky <odersky@gmail.com> | 2015-04-03 14:32:45 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-04-07 23:43:15 +0200 |
commit | aa11237158ddf5cdbf25acc6304efb50ff10d49d (patch) | |
tree | 0563dc077e2502d048406ffe96c87faa9130b947 /src/dotty/tools/dotc/core/Denotations.scala | |
parent | c2072ad703fc237d494ceae50d4189e85e91a2ae (diff) | |
download | dotty-aa11237158ddf5cdbf25acc6304efb50ff10d49d.tar.gz dotty-aa11237158ddf5cdbf25acc6304efb50ff10d49d.tar.bz2 dotty-aa11237158ddf5cdbf25acc6304efb50ff10d49d.zip |
Cleanup of installAfter
Same functionality achieved in a simpler way. Also, make sure
initial works for stale denotations that refer to some other cycle.
Diffstat (limited to 'src/dotty/tools/dotc/core/Denotations.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Denotations.scala | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/dotty/tools/dotc/core/Denotations.scala b/src/dotty/tools/dotc/core/Denotations.scala index ceb996171..849e934f0 100644 --- a/src/dotty/tools/dotc/core/Denotations.scala +++ b/src/dotty/tools/dotc/core/Denotations.scala @@ -476,12 +476,14 @@ object Denotations { /** The version of this SingleDenotation that was valid in the first phase * of this run. */ - def initial: SingleDenotation = { - var current = nextInRun - while (current.validFor.code > this.myValidFor.code) current = current.nextInRun - current - } - + def initial: SingleDenotation = + if (validFor == Nowhere) this + else { + var current = nextInRun + while (current.validFor.code > this.myValidFor.code) current = current.nextInRun + current + } + def history: List[SingleDenotation] = { val b = new ListBuffer[SingleDenotation] var current = initial @@ -615,16 +617,13 @@ object Denotations { val current = symbol.current // println(s"installing $this after $phase/${phase.id}, valid = ${current.validFor}") // printPeriods(current) - if (current.nextInRun ne current) - this.nextInRun = current.nextInRun - else - this.nextInRun = this this.validFor = Period(ctx.runId, targetId, current.validFor.lastPhaseId) if (current.validFor.firstPhaseId == targetId) { // replace current with this denotation var prev = current while (prev.nextInRun ne current) prev = prev.nextInRun prev.nextInRun = this + this.nextInRun = current.nextInRun current.validFor = Nowhere } else { // insert this denotation after current |