aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/Run.scala
diff options
context:
space:
mode:
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