aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Denotations.scala
diff options
context:
space:
mode:
authorSébastien Doeraene <sjrdoeraene@gmail.com>2014-04-05 10:43:41 +0200
committerSébastien Doeraene <sjrdoeraene@gmail.com>2014-04-05 10:43:41 +0200
commit26185f6b17429d2af7686139dbb4d13ede4c9e99 (patch)
tree0a45286d1dc97b76665f4cd1b8b996631b479c6b /src/dotty/tools/dotc/core/Denotations.scala
parent839a9fc5ecb2371672f25c2c5f639d0952ad8bbc (diff)
parente1713aa311cf3bee7fb52e7eaefa481097a72a82 (diff)
downloaddotty-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/tools/dotc/core/Denotations.scala')
-rw-r--r--src/dotty/tools/dotc/core/Denotations.scala24
1 files changed, 24 insertions, 0 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}"