diff options
author | Sébastien Doeraene <sjrdoeraene@gmail.com> | 2014-04-05 10:43:41 +0200 |
---|---|---|
committer | Sébastien Doeraene <sjrdoeraene@gmail.com> | 2014-04-05 10:43:41 +0200 |
commit | 26185f6b17429d2af7686139dbb4d13ede4c9e99 (patch) | |
tree | 0a45286d1dc97b76665f4cd1b8b996631b479c6b /src/dotty | |
parent | 839a9fc5ecb2371672f25c2c5f639d0952ad8bbc (diff) | |
parent | e1713aa311cf3bee7fb52e7eaefa481097a72a82 (diff) | |
download | dotty-26185f6b17429d2af7686139dbb4d13ede4c9e99.tar.gz dotty-26185f6b17429d2af7686139dbb4d13ede4c9e99.tar.bz2 dotty-26185f6b17429d2af7686139dbb4d13ede4c9e99.zip |
Merge pull request #116 from dotty-staging/add/Denotation-update
Install method for SymDenotations
Diffstat (limited to 'src/dotty')
-rw-r--r-- | src/dotty/tools/dotc/core/Denotations.scala | 24 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/SymDenotations.scala | 6 |
2 files changed, 29 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/Denotations.scala b/src/dotty/tools/dotc/core/Denotations.scala index 1e3dec255..e9b9b20c4 100644 --- a/src/dotty/tools/dotc/core/Denotations.scala +++ b/src/dotty/tools/dotc/core/Denotations.scala @@ -572,6 +572,30 @@ object Denotations { } } + /** Install this denotation to be the result of the given denotation transformer. + * This is the implementation of the same-named method in SymDenotations. + * It's placed here because it needs access to private fields of SingleDenotation. + */ + protected def installAfter(phase: DenotTransformer)(implicit ctx: Context): Unit = { + val targetId = phase.next.id + assert(ctx.phaseId == targetId, + s"denotation update for $this called in phase ${ctx.phase}, expected was ${phase.next}") + val current = symbol.current + this.nextInRun = current.nextInRun + 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 + } + else { + // insert this denotation after current + current.validFor = Period(ctx.runId, current.validFor.firstPhaseId, targetId - 1) + current.nextInRun = this + } + } + def staleSymbolError(implicit ctx: Context) = { def ownerMsg = this match { case denot: SymDenotation => s"in ${denot.owner}" diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index e96f08855..7762f61dd 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -752,7 +752,7 @@ object SymDenotations { def debugString = toString+"#"+symbol.id // !!! DEBUG - // ----- copies ------------------------------------------------------ + // ----- copies and transforms ---------------------------------------- protected def newLikeThis(s: Symbol, i: Type): SingleDenotation = new UniqueRefDenotation(s, i, validFor) @@ -774,6 +774,10 @@ object SymDenotations { d.annotations = annotations1 d } + + /** Install this denotation as the result of the given denotation transformer. */ + override def installAfter(phase: DenotTransformer)(implicit ctx: Context): Unit = + super.installAfter(phase) } /** The contents of a class definition during a period |