diff options
author | Martin Odersky <odersky@gmail.com> | 2013-08-14 16:07:59 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-08-14 16:07:59 +0200 |
commit | f19250b1a123aa63cf8f14096bfd8e29e7e548b2 (patch) | |
tree | a676a2d5c8e3dc494c4736c9d1454294b9b10341 /src/dotty/tools/dotc/Run.scala | |
parent | c6f0c00790c996bea57ea905a830dedcb4f2bb44 (diff) | |
download | dotty-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.scala | 26 |
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 |