summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McDirmid <sean.mcdirmid@gmail.com>2008-05-31 06:45:01 +0000
committerSean McDirmid <sean.mcdirmid@gmail.com>2008-05-31 06:45:01 +0000
commit5d1a536a04758d58c88931a37a460f0c7dcfc30f (patch)
treeda8a67fc07a3f56ebf50d093199554925f057e4b
parent562647a37a6675fbf328f72e081a7f88913dd004 (diff)
downloadscala-5d1a536a04758d58c88931a37a460f0c7dcfc30f.tar.gz
scala-5d1a536a04758d58c88931a37a460f0c7dcfc30f.tar.bz2
scala-5d1a536a04758d58c88931a37a460f0c7dcfc30f.zip
Changes to support exposing AST in plugin.
-rw-r--r--src/compiler/scala/tools/nsc/ast/Trees.scala1
-rw-r--r--src/compiler/scala/tools/nsc/symtab/IdeSupport.scala24
2 files changed, 20 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/Trees.scala b/src/compiler/scala/tools/nsc/ast/Trees.scala
index ceab218a8d..c3d1cb92b8 100644
--- a/src/compiler/scala/tools/nsc/ast/Trees.scala
+++ b/src/compiler/scala/tools/nsc/ast/Trees.scala
@@ -809,6 +809,7 @@ trait Trees {
extends TypTree
trait StubTree extends Tree {
+ def underlying : AnyRef
override def equalsStructure0(that: Tree)(f : (Tree,Tree) => Boolean): Boolean = this eq that
}
/* A standard pattern match
diff --git a/src/compiler/scala/tools/nsc/symtab/IdeSupport.scala b/src/compiler/scala/tools/nsc/symtab/IdeSupport.scala
index 17891b3117..2743b78c3f 100644
--- a/src/compiler/scala/tools/nsc/symtab/IdeSupport.scala
+++ b/src/compiler/scala/tools/nsc/symtab/IdeSupport.scala
@@ -261,11 +261,13 @@ trait IdeSupport extends SymbolTable { // added to global, not analyzers.
trait HasClients {
def record(client : ScopeClient, name : Name) : Unit
- def invalidate(name : Name) : Unit
+ def record(client : Function1[PersistentScope,Unit]) : Unit
+ def invalidate(from : PersistentScope, name : Name) : Unit
}
trait ReallyHasClients extends HasClients {
private var clients : Map = null
+ private var anyClients : LinkedHashSet[Function1[PersistentScope,Unit]] = null
private class Map extends LinkedHashMap[Int,LinkedHashSet[ScopeClient]] {
override def default(hash : Int) = {
val set = new LinkedHashSet[ScopeClient]
@@ -277,9 +279,21 @@ trait IdeSupport extends SymbolTable { // added to global, not analyzers.
if (clients eq null) clients = new Map
clients(name.start)
})
- override def invalidate(name : Name) : Unit = if (clients ne null) clients.removeKey(name.start) match {
- case Some(clients) => clients.foreach(_.changed)
- case None =>
+ def record(client : Function1[PersistentScope,Unit]) = {
+ if (anyClients == null) anyClients = new LinkedHashSet[Function1[PersistentScope,Unit]]
+ anyClients += client
+ }
+
+ override def invalidate(from : PersistentScope, name : Name) : Unit = {
+ if (clients ne null) clients.removeKey(name.start) match {
+ case Some(clients) => clients.foreach(_.changed)
+ case None =>
+ }
+ if (anyClients != null) {
+ var c = anyClients
+ anyClients = null
+ c.foreach(_.apply(from))
+ }
}
}
@@ -287,7 +301,7 @@ trait IdeSupport extends SymbolTable { // added to global, not analyzers.
class PersistentScope(val key : AnyRef, val owner : HasClients) extends HookedScope(null) {
override def record(client : ScopeClient, name : Name) =
owner.record(client, name)
- override def invalidate(name : Name) : Unit = owner.invalidate(name)
+ override def invalidate(name : Name) : Unit = owner.invalidate(this,name)
override def enter(symbol : Symbol) : Symbol = {
if (currentClient.makeNoChanges) { // might have unpickles.
return if (lookupEntry(symbol.name) == null)