diff options
author | Paul Phillips <paulp@improving.org> | 2009-02-09 14:35:15 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-02-09 14:35:15 +0000 |
commit | 3811981e422bc0d2ccba4f6b3455e0aa5c59f82f (patch) | |
tree | c4b3dc61409a8b0a7f04f9a159ea65be66e01156 /src/compiler | |
parent | a6340e3280a6e526b5b7ca5b2b9ed144f47fe29c (diff) | |
download | scala-3811981e422bc0d2ccba4f6b3455e0aa5c59f82f.tar.gz scala-3811981e422bc0d2ccba4f6b3455e0aa5c59f82f.tar.bz2 scala-3811981e422bc0d2ccba4f6b3455e0aa5c59f82f.zip |
repaired init order issue with the fix for #1602.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/CompilerCommand.scala | 18 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/GenericRunnerCommand.scala | 6 |
2 files changed, 16 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/CompilerCommand.scala b/src/compiler/scala/tools/nsc/CompilerCommand.scala index 1c1d17a638..c5c7f84434 100644 --- a/src/compiler/scala/tools/nsc/CompilerCommand.scala +++ b/src/compiler/scala/tools/nsc/CompilerCommand.scala @@ -8,8 +8,15 @@ package scala.tools.nsc /** A class representing command line info for scalac */ -class CompilerCommand(arguments: List[String], val settings: Settings, - error: String => Unit, interactive: Boolean) { +class CompilerCommand( + arguments: List[String], + val settings: Settings, + error: String => Unit, + interactive: Boolean, + shouldProcessArguments: Boolean) +{ + def this(arguments: List[String], settings: Settings, error: String => Unit, interactive: Boolean) = + this(arguments, settings, error, interactive, true) private var fs: List[String] = List() @@ -144,9 +151,10 @@ class CompilerCommand(arguments: List[String], val settings: Settings, ok &&= settings.checkDependencies } - // setting up a hook so GenericRunnerCommand (at least) can see processArguments - // run after this constructor completes, but without seeing it run twice - val shouldProcessArguments = true + // CompilerCommand needs processArguments called at the end of its constructor, + // as does its subclass GenericRunnerCommand, but it cannot be called twice as it + // accumulates arguments. The fact that it's called from within the constructors + // makes initialization order an obstacle to simplicity. if (shouldProcessArguments) processArguments() } diff --git a/src/compiler/scala/tools/nsc/GenericRunnerCommand.scala b/src/compiler/scala/tools/nsc/GenericRunnerCommand.scala index 72f1e1e3f2..a131a6e737 100644 --- a/src/compiler/scala/tools/nsc/GenericRunnerCommand.scala +++ b/src/compiler/scala/tools/nsc/GenericRunnerCommand.scala @@ -12,7 +12,7 @@ class GenericRunnerCommand( allargs: List[String], override val settings: GenericRunnerSettings, error: String => Unit) -extends CompilerCommand(allargs, settings, error, false) +extends CompilerCommand(allargs, settings, error, false, false) { def this(allargs: List[String], error: String=>Unit) = this(allargs, new GenericRunnerSettings(error), error) @@ -50,8 +50,8 @@ extends CompilerCommand(allargs, settings, error, false) } } - override val shouldProcessArguments = false // tell superclass not to process arguments - processArguments() // ...and process them ourselves + // we can safely call processArguments since we passed the superclass shouldProcessArguments=false + processArguments() override def usageMsg = { cmdName + " [ <option> ]... [<torun> <arguments>]\n" + |