summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/Global.scala
diff options
context:
space:
mode:
authorGeoffrey Washburn <geoffrey.washburn@epfl.ch>2008-11-21 16:50:31 +0000
committerGeoffrey Washburn <geoffrey.washburn@epfl.ch>2008-11-21 16:50:31 +0000
commitbe91cd08be3590f6cdbb9356b4d093725d5e06ff (patch)
tree60a300ebeaaa4875ffc705f62054f88220bad80f /src/compiler/scala/tools/nsc/Global.scala
parentc63b3a7e7ad089d207dfd57267a356d615a2e03f (diff)
downloadscala-be91cd08be3590f6cdbb9356b4d093725d5e06ff.tar.gz
scala-be91cd08be3590f6cdbb9356b4d093725d5e06ff.tar.bz2
scala-be91cd08be3590f6cdbb9356b4d093725d5e06ff.zip
Fixed #1440 and generally cleaned up things a bit.
Diffstat (limited to 'src/compiler/scala/tools/nsc/Global.scala')
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index ac2be354eb..831d100558 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -655,16 +655,18 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable
def compile(filenames: List[String]) {
try {
val scriptMain = settings.script.value
- if (scriptMain != "" && filenames.length != 1)
- error("can only compile one script at a time")
- val sources = filenames map (
- if (scriptMain != "")
- (x => ScriptRunner.wrappedScript(scriptMain, x, getSourceFile _))
- else
- getSourceFile)
- compileSources(sources)
+ // Are we compiling a script?
+ if (scriptMain != "") {
+ if(filenames.length != 1)
+ error("can only compile one script at a time")
+ val scriptFile =
+ ScriptRunner.wrappedScript(scriptMain, filenames.head, getSourceFile)
+ compileSources(List(scriptFile))
+ // No we are compiling regular source files
+ } else {
+ compileSources(filenames map getSourceFile)
+ }
} catch {
- case ScriptRunner.ScriptException(msg) => error(msg)
case ex: IOException => error(ex.getMessage())
}
}