blob: e0b762f33b30636c829fab9fb86c1aec48bc3c2d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
package dotty.tools.dotc.core
import Periods._, Denotations._, Contexts._, Types._
import java.lang.AssertionError
trait DenotationTransformers { self: RootContext =>
import DenotationTransformers._
def lastPhaseId: PhaseId
private val nxTransformer =
Array.fill[DenotationTransformer](lastPhaseId + 1)(NoTransformer)
object NoTransformer extends DenotationTransformer {
val phaseId = lastPhaseId + 1
def transform(enot: Denotation): Denotation =
throw new AssertionError("NoTransformer.transform")
}
def install(pid: PhaseId, trans: DenotationTransformer): Unit = {
if ((pid > NoPhaseId) && (nxTransformer(pid).phaseId > pid)) {
nxTransformer(pid) = trans
install(pid - 1, trans)
}
}
def nextTransformer(i: Int) = nxTransformer(i)
}
object DenotationTransformers {
abstract class DenotationTransformer {
val phaseId: PhaseId
def transform(denot: Denotation): Denotation
def transform(tpe: Type): Type = ???
}
}
|