aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Denotations.scala
diff options
context:
space:
mode:
authorDmitry Petrashko <dmitry.petrashko@gmail.com>2014-03-17 22:25:47 +0100
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2014-03-19 15:53:47 +0100
commit09d02bd3670b947da147aec40835822d894b17b0 (patch)
tree01e81ad97df8b0e3e59cb72b3b77893e1d6f1070 /src/dotty/tools/dotc/core/Denotations.scala
parent5cbd2fbc8409b446f8751792b006693e1d091055 (diff)
downloaddotty-09d02bd3670b947da147aec40835822d894b17b0.tar.gz
dotty-09d02bd3670b947da147aec40835822d894b17b0.tar.bz2
dotty-09d02bd3670b947da147aec40835822d894b17b0.zip
Allow MiniPhase to be DenotTransformer
All MiniPhases now as are full-fledged phases, and are given their own periods and can register DenotTransformers. MiniPhases belonging to same group(list) will be squashed to single phase.
Diffstat (limited to 'src/dotty/tools/dotc/core/Denotations.scala')
-rw-r--r--src/dotty/tools/dotc/core/Denotations.scala13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/core/Denotations.scala b/src/dotty/tools/dotc/core/Denotations.scala
index b35647ead..e15c70637 100644
--- a/src/dotty/tools/dotc/core/Denotations.scala
+++ b/src/dotty/tools/dotc/core/Denotations.scala
@@ -501,6 +501,8 @@ object Denotations {
def current(implicit ctx: Context): SingleDenotation = {
val currentPeriod = ctx.period
val valid = myValidFor
+ assert(valid.code > 0, s"negative period $valid: ${valid.code}")
+
if (valid.runId != currentPeriod.runId) bringForward.current
else {
var cur = this
@@ -514,12 +516,15 @@ object Denotations {
if (next.validFor.code > valid.code) {
// in this case, next.validFor contains currentPeriod
cur = next
+ cur
} else {
// not found, cur points to highest existing variant
var startPid = cur.validFor.lastPhaseId + 1
- val transformer = ctx.phases(startPid - 1).asInstanceOf[DenotTransformer]
+ val nextTranformerId = ctx.nextDenotTransformerId(startPid)
+ val transformer = ctx.denotTransformers(nextTranformerId)
//println(s"transforming with $transformer")
- next = transformer.transform(cur).syncWithParents
+ if (currentPeriod.lastPhaseId > transformer.id)
+ next = transformer.transform(cur).syncWithParents
if (next eq cur)
startPid = cur.validFor.firstPhaseId
else {
@@ -534,6 +539,7 @@ object Denotations {
cur.validFor = Period(
currentPeriod.runId, startPid, transformer.lastPhaseId)
//println(s"new denot: $cur, valid for ${cur.validFor}")
+ cur.current // multiple transformations could be required
}
} else {
// currentPeriod < end of valid; in this case a version must exist
@@ -545,8 +551,9 @@ object Denotations {
cnt += 1
assert(cnt <= MaxPossiblePhaseId, s"seems to be a loop in Denotations for $this, currentPeriod = $currentPeriod")
}
+ cur
}
- cur
+
}
}