aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/Run.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/Run.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/Run.scala')
-rw-r--r--src/dotty/tools/dotc/Run.scala26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/Run.scala b/src/dotty/tools/dotc/Run.scala
index 8358cdbca..923e5f8b2 100644
--- a/src/dotty/tools/dotc/Run.scala
+++ b/src/dotty/tools/dotc/Run.scala
@@ -2,11 +2,31 @@ package dotty.tools
package dotc
import core._
-import Contexts._
+import Contexts._, Periods._, Symbols._
+import io.PlainFile
+import util.{SourceFile, NoSource}
class Run(comp: Compiler)(implicit ctx: Context) {
- def compile(fileNames: List[String]): Unit =
- for (name <- fileNames) println(s"<compiling $name>")
+ defn.init()
+ var units: List[CompilationUnit] = _
+
+ def getSource(fileName: String): SourceFile = {
+ val f = new PlainFile(fileName)
+ if (f.exists) new SourceFile(f)
+ else {
+ ctx.error(s"not found: $fileName")
+ NoSource
+ }
+ }
+
+ def compile(fileNames: List[String]): Unit = {
+ val sources = fileNames map getSource
+ if (sources forall (_.exists)) {
+ units = sources map (new CompilationUnit(_))
+ for (phase <- ctx.allPhases)
+ phase.runOn(units)
+ }
+ }
} \ No newline at end of file