summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2009-05-29 18:35:04 +0000
committerMartin Odersky <odersky@gmail.com>2009-05-29 18:35:04 +0000
commit488f986078c4f80381849f66d30d2e24818dbff9 (patch)
tree240ba26b107e11a94ff79a5a223ded056724ac77 /src/compiler/scala/tools/nsc/interactive/CompilerControl.scala
parentda10214991cba1fa963453c66f3af94ac5ac6db4 (diff)
downloadscala-488f986078c4f80381849f66d30d2e24818dbff9.tar.gz
scala-488f986078c4f80381849f66d30d2e24818dbff9.tar.bz2
scala-488f986078c4f80381849f66d30d2e24818dbff9.zip
first attempt at command completion; more fiddl...
first attempt at command completion; more fiddling with positions
Diffstat (limited to 'src/compiler/scala/tools/nsc/interactive/CompilerControl.scala')
-rw-r--r--src/compiler/scala/tools/nsc/interactive/CompilerControl.scala17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala b/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala
index 8d4c18fbf7..9db09c7f88 100644
--- a/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala
+++ b/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala
@@ -10,6 +10,14 @@ import scala.tools.nsc.ast._
*/
trait CompilerControl { self: Global =>
+ object MemberStatus extends Enumeration {
+ val Accessible, Inherited, Implicit = Value
+ }
+
+ type Response[T] = SyncVar[Either[T, Throwable]]
+
+ type Member = (Symbol, Type, MemberStatus.ValueSet)
+
/* Must be initialized before starting compilerRunner */
protected val scheduler = new WorkScheduler
@@ -38,12 +46,15 @@ trait CompilerControl { self: Global =>
locateContext(unitOf(pos).contexts, pos)
/** Make sure a set of compilation units is loaded and parsed */
- def askReload(sources: List[SourceFile], result: SyncVar[Either[Unit, Throwable]]) =
+ def askReload(sources: List[SourceFile], result: Response[Unit]) =
scheduler.postWorkItem(() => reload(sources, result))
/** Set sync var `result` to a fully attributed tree located at position `pos` */
- def askTypeAt(pos: Position, result: SyncVar[Either[Tree, Throwable]]) =
- scheduler.postWorkItem(() => self.typedTreeAt(pos, result))
+ def askTypeAt(pos: Position, result: Response[Tree]) =
+ scheduler.postWorkItem(() => self.getTypedTreeAt(pos, result))
+
+ def askCompletion(pos: Position, result: Response[List[Member]]) =
+ scheduler.postWorkItem(() => self.completion(pos, result))
/** Ask to do unit first on present and subsequent type checking passes */
def askToDoFirst(f: SourceFile) = {