blob: 5913875b832e0d59dd31711b3366fae2e02b02d3 (
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
|
package dotty.tools.dotc
package transform
import TreeTransforms._
import core.DenotTransformers._
import core.Denotations._
import core.SymDenotations._
import core.Contexts._
import core.Symbols._
import core.Types._
import core.Constants._
import core.StdNames._
import core.Decorators._
import core.transform.Erasure.isUnboundedGeneric
import typer.ErrorReporting._
import ast.Trees._
/** This transform eliminates patterns. Right now it's a dummy.
* Awaiting the real pattern matcher.
*/
class TreeChecker {
import ast.tpd._
def check(ctx: Context) = {
println(s"checking ${ctx.compilationUnit} after phase ${ctx.phase.prev}")
Checker.transform(ctx.compilationUnit.tpdTree)(ctx)
}
object Checker extends TreeMap {
override def transform(tree: Tree)(implicit ctx: Context) = {
println(i"checking $tree")
assert(tree.isEmpty || tree.hasType, tree.show)
super.transform(tree)
}
}
}
object TreeChecker extends TreeChecker
|