diff options
author | michelou <michelou@epfl.ch> | 2008-05-02 16:06:59 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2008-05-02 16:06:59 +0000 |
commit | 6b515dd6afa70077ff57f14e01baf6c29986ee8b (patch) | |
tree | fa6eae8b38183f56897a58f9f34e2196ca574cb8 | |
parent | 76c76b28f952584210fd851f95877b84f0b688a2 (diff) | |
download | scala-6b515dd6afa70077ff57f14e01baf6c29986ee8b.tar.gz scala-6b515dd6afa70077ff57f14e01baf6c29986ee8b.tar.bz2 scala-6b515dd6afa70077ff57f14e01baf6c29986ee8b.zip |
replaced null test by try/catch (Console.readLine)
-rw-r--r-- | src/compiler/scala/tools/nsc/EvalLoop.scala | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/EvalLoop.scala b/src/compiler/scala/tools/nsc/EvalLoop.scala index ea58f8b9b0..4558bd1def 100644 --- a/src/compiler/scala/tools/nsc/EvalLoop.scala +++ b/src/compiler/scala/tools/nsc/EvalLoop.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2007 LAMP/EPFL + * Copyright 2005-2008 LAMP/EPFL * @author Martin Odersky */ // $Id$ @@ -12,10 +12,15 @@ trait EvalLoop { def loop(action: (String) => Unit) { Console.print(prompt) - val line = Console.readLine - if ((line ne null) && line.length() > 0) { - action(line) - loop(action) + try { + val line = Console.readLine + if (line.length() > 0) { + action(line) + loop(action) + } + } + catch { + case _: java.io.EOFException => //nop } } |