summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLex Spoon <lex@lexspoon.org>2007-05-30 10:58:09 +0000
committerLex Spoon <lex@lexspoon.org>2007-05-30 10:58:09 +0000
commitca6b2dcd8104b2bebc6edcaf76618d7bae07290b (patch)
tree5fb45da0e6bfaa74352b5886404b600d134bb21f
parent31d539218aaddc9e225800fc9c28869f4b6b96ab (diff)
downloadscala-ca6b2dcd8104b2bebc6edcaf76618d7bae07290b.tar.gz
scala-ca6b2dcd8104b2bebc6edcaf76618d7bae07290b.tar.bz2
scala-ca6b2dcd8104b2bebc6edcaf76618d7bae07290b.zip
Settings.tryToSet consistently returns its inpu...
Settings.tryToSet consistently returns its input arguments if there is an error. That way, the command-line parser can consitently recognize that there is an erroneous option and abort.
-rw-r--r--src/compiler/scala/tools/nsc/GenericRunnerCommand.scala2
-rw-r--r--src/compiler/scala/tools/nsc/Settings.scala6
2 files changed, 4 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/GenericRunnerCommand.scala b/src/compiler/scala/tools/nsc/GenericRunnerCommand.scala
index 26742f5a88..3c08c603af 100644
--- a/src/compiler/scala/tools/nsc/GenericRunnerCommand.scala
+++ b/src/compiler/scala/tools/nsc/GenericRunnerCommand.scala
@@ -33,7 +33,7 @@ class GenericRunnerCommand(allargs: List[String], error: String => Unit) {
if (args eq args0)
args = setting.tryToSet(args)
if (args eq args0) {
- error("unknown option: '" + args.head + "'")
+ error("bad option: '" + args.head + "'")
ok = false
}
}
diff --git a/src/compiler/scala/tools/nsc/Settings.scala b/src/compiler/scala/tools/nsc/Settings.scala
index 87d0defa00..79b6a6c140 100644
--- a/src/compiler/scala/tools/nsc/Settings.scala
+++ b/src/compiler/scala/tools/nsc/Settings.scala
@@ -206,7 +206,7 @@ class Settings(error: String => Unit) {
/** If first arg defines this setting, consume it as well as all following
* args needed to define the setting. If this can be done without
* error, set value field and return suffix of args else
- * issue error message and return empty.
+ * issue error message and return the arguments unchanged.
* If first arg does not define this setting return args unchanged.
*/
def tryToSet(args: List[String]): List[String]
@@ -267,7 +267,7 @@ class Settings(error: String => Unit) {
case n :: rest if (name == n || abbreviation == n) =>
if (rest.isEmpty) {
error("missing argument")
- List()
+ args
} else {
value = rest.head
rest.tail
@@ -374,7 +374,7 @@ class Settings(error: String => Unit) {
val phase = n.substring(name.length() + 1)
if (phase == "") {
error("missing phase")
- List()
+ args
} else {
value = value ::: List(phase)
rest