aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/TyperPhase.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-08-14 16:07:59 +0200
committerMartin Odersky <odersky@gmail.com>2013-08-14 16:07:59 +0200
commitf19250b1a123aa63cf8f14096bfd8e29e7e548b2 (patch)
treea676a2d5c8e3dc494c4736c9d1454294b9b10341 /src/dotty/tools/dotc/typer/TyperPhase.scala
parentc6f0c00790c996bea57ea905a830dedcb4f2bb44 (diff)
downloaddotty-f19250b1a123aa63cf8f14096bfd8e29e7e548b2.tar.gz
dotty-f19250b1a123aa63cf8f14096bfd8e29e7e548b2.tar.bz2
dotty-f19250b1a123aa63cf8f14096bfd8e29e7e548b2.zip
Integrated parser/typer into compiler
Some initial bug fixes. Added -explaintypes diagnostics.
Diffstat (limited to 'src/dotty/tools/dotc/typer/TyperPhase.scala')
-rw-r--r--src/dotty/tools/dotc/typer/TyperPhase.scala43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/typer/TyperPhase.scala b/src/dotty/tools/dotc/typer/TyperPhase.scala
new file mode 100644
index 000000000..c43aae47f
--- /dev/null
+++ b/src/dotty/tools/dotc/typer/TyperPhase.scala
@@ -0,0 +1,43 @@
+package dotty.tools.dotc
+package typer
+
+import core._
+import Phases._
+import Contexts._
+import parsing.Parsers.Parser
+
+class FrontEnd extends Phase {
+
+ def name = "frontend"
+
+ def parse(implicit ctx: Context) = {
+ val unit = ctx.compilationUnit
+ unit.untpdTree = new Parser(unit.source).parse()
+ println("parsed:\n"+unit.untpdTree.show)
+ }
+
+ def enterSyms(implicit ctx: Context) = {
+ val unit = ctx.compilationUnit
+ ctx.typer.enterSym(unit.untpdTree)
+ println("entered:\n"+unit.source)
+ }
+
+ def typeCheck(implicit ctx: Context) = {
+ val unit = ctx.compilationUnit
+ unit.tpdTree = ctx.typer.typedExpr(unit.untpdTree)
+ println("typed:\n"+unit.source)
+ }
+
+ override def runOn(units: List[CompilationUnit])(implicit ctx: Context): Unit = {
+ val unitContexts = units map ctx.fresh.withCompilationUnit
+ unitContexts foreach (parse(_))
+ unitContexts foreach (enterSyms(_))
+ unitContexts foreach (typeCheck(_))
+ }
+
+ override def run(implicit ctx: Context): Unit = {
+ parse
+ enterSyms
+ typeCheck
+ }
+} \ No newline at end of file