diff options
author | Paul Phillips <paulp@improving.org> | 2009-06-20 16:55:48 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-06-20 16:55:48 +0000 |
commit | 8cf7228f8c1e11d67f4b7053b4ff2772e2bd79fc (patch) | |
tree | 0517282d9e1beb8330a694617504795d6ae2f6c4 /src/compiler | |
parent | 533764a7180c005024e997246a56ee9fce337bb5 (diff) | |
download | scala-8cf7228f8c1e11d67f4b7053b4ff2772e2bd79fc.tar.gz scala-8cf7228f8c1e11d67f4b7053b4ff2772e2bd79fc.tar.bz2 scala-8cf7228f8c1e11d67f4b7053b4ff2772e2bd79fc.zip |
Created DelayedLazyVal for your def/val hybrid ...
Created DelayedLazyVal for your def/val hybrid needs.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/interpreter/Completion.scala | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/Completion.scala b/src/compiler/scala/tools/nsc/interpreter/Completion.scala index 2239f7cc3a..599ad8fa18 100644 --- a/src/compiler/scala/tools/nsc/interpreter/Completion.scala +++ b/src/compiler/scala/tools/nsc/interpreter/Completion.scala @@ -24,6 +24,7 @@ package scala.tools.nsc.interpreter import jline._ import java.net.URL import java.util.concurrent.ConcurrentHashMap +import scala.concurrent.DelayedLazyVal // REPL completor - queries supplied interpreter for valid completions // based on current contents of buffer. @@ -32,23 +33,10 @@ class Completion(val interpreter: Interpreter) extends Completor { import java.util.{ List => JList } import interpreter.compilerClasspath - // This is a wrapper which lets us use a def until some lengthy - // action is complete, and then a val from that point on. - class LazyValFuture[T](f: () => T, body: => Unit) { - private[this] var isDone = false - private[this] lazy val complete = f() - def apply(): T = if (isDone) complete else f() - - scala.concurrent.ops.future { - body - isDone = true - } - } - // it takes a little while to look through the jars so we use a future and a concurrent map class CompletionAgent { val dottedPaths = new ConcurrentHashMap[String, List[String]] - val topLevelPackages = new LazyValFuture( + val topLevelPackages = new DelayedLazyVal( () => enumToList(dottedPaths.keys) filterNot (_ contains '.'), getDottedPaths(dottedPaths, interpreter) ) |