blob: 5a6578bea1de074e10a1011f000c74a916284b28 (
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
|
package dotty.tools.dotc
package transform
import TreeTransforms._
import core.Denotations._
import core.Contexts._
import ast.Trees._
import ast.tpd.{Apply, Tree, cpy}
import core.Transformers._
class SamplePhase extends TreeTransformer {
def init(implicit ctx: Context) = {
ctx.base.infoTransformers.install(id, new UncurryInfoTransform(_))
}
def name = "sample"
def transformations = Array(new UncurryTreeTransform(_, _))
}
class UncurryInfoTransform(group: TransformerGroup) extends Transformer(group) {
def transform(ref: SingleDenotation)(implicit ctx: Context): SingleDenotation = ???
}
class UncurryTreeTransform(group: TreeTransformer, idx: Int) extends TreeTransform(group, idx) {
override def transformApply(tree: Apply)(implicit ctx: Context, info: TransformerInfo): Tree =
tree match {
case Apply(fn, args) => cpy.Apply(tree, fn, args ++ tree.args)
case _ => tree
}
}
|