summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSean McDirmid <sean.mcdirmid@gmail.com>2006-11-24 13:12:57 +0000
committerSean McDirmid <sean.mcdirmid@gmail.com>2006-11-24 13:12:57 +0000
commitf814b3162e06898c359cea623e3dd0f82df0d4ed (patch)
tree8bea30711930b1d3fb746dea09f62b977dbbc20b /src
parent5baf3e447f5c909591e75a8bb77968067f625420 (diff)
downloadscala-f814b3162e06898c359cea623e3dd0f82df0d4ed.tar.gz
scala-f814b3162e06898c359cea623e3dd0f82df0d4ed.tar.bz2
scala-f814b3162e06898c359cea623e3dd0f82df0d4ed.zip
Map.scala: added simple keySet method.
Trees.scala: added &~ operator to flags. Signatures.scala: trying to ignore synthetic flag in computed signatures. Infer.scala: fixed bug where dependency was being attributed to wrong unit.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/ast/Trees.scala5
-rw-r--r--src/compiler/scala/tools/nsc/models/Signatures.scala7
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Infer.scala8
-rw-r--r--src/library/scala/collection/Map.scala8
4 files changed, 23 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/Trees.scala b/src/compiler/scala/tools/nsc/ast/Trees.scala
index 7e58592361..57967a9294 100644
--- a/src/compiler/scala/tools/nsc/ast/Trees.scala
+++ b/src/compiler/scala/tools/nsc/ast/Trees.scala
@@ -36,6 +36,11 @@ trait Trees requires Global {
if (flags1 == flags) this
else Modifiers(flags1, privateWithin) setAttr attributes
}
+ def &~ (flag: Int): Modifiers = {
+ val flags1 = flags & (~flag)
+ if (flags1 == flags) this
+ else Modifiers(flags1, privateWithin) setAttr attributes
+ }
def | (flag: int): Modifiers = {
val flags1 = flags | flag
if (flags1 == flags) this
diff --git a/src/compiler/scala/tools/nsc/models/Signatures.scala b/src/compiler/scala/tools/nsc/models/Signatures.scala
index b394edc3a4..86a6ed3fd7 100644
--- a/src/compiler/scala/tools/nsc/models/Signatures.scala
+++ b/src/compiler/scala/tools/nsc/models/Signatures.scala
@@ -48,9 +48,12 @@ class Signatures(val compiler: Compiler) {
*/
def signature(tree0: Tree, rest: List[Signature]): List[Signature] = tree0 match {
case tree: MemberDef => if (!tree.mods.isPrivate) {
- val name = "" + tree.name + "::" + tree.mods
+ val name = "" + tree.name + "::" +
+ (tree.mods &~ Flags.SYNTHETIC)
+
val children: List[Signature] = tree match {
- case impl: ImplDef =>
+ case impl: ImplDef
+ if (!impl.name.toString.contains("$anonfun$")) =>
val supers = new Signature("$$supers", signature(impl.impl.parents))
val body = new Signature("$$body", signature(impl.impl.body))
val ret = supers :: body :: Nil
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
index b772ff4ea0..0e118028db 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
@@ -323,11 +323,13 @@ trait Infer requires Analyzer {
errorTree(tree, underlying(sym).toString() + " cannot be accessed in " +
(if (sym.isClassConstructor) context.enclClass.owner else pre.widen) +
explanation)
- sym.toplevelClass match {
+ if (context.unit != null) sym.toplevelClass match {
case clazz : ClassSymbol =>
// System.err.println("TOP: " + clazz + " " + clazz.sourceFile)
- if (clazz.sourceFile ne null)
- global.currentRun.currentUnit.depends += clazz.sourceFile
+ if (clazz.sourceFile != null) {
+ context.unit.depends += clazz.sourceFile
+ //Console.println("DEPEND " + global.currentRun.currentUnit + " ON " + clazz.sourceFile + " XXX " + context.unit)
+ }
case _ =>
}
diff --git a/src/library/scala/collection/Map.scala b/src/library/scala/collection/Map.scala
index 211158f047..ad3dc29380 100644
--- a/src/library/scala/collection/Map.scala
+++ b/src/library/scala/collection/Map.scala
@@ -76,6 +76,14 @@ trait Map[A, +B] extends AnyRef
case Some(_) => true
}
+ /** @return the keys of this map as a set.
+ */
+ def keySet = new Set[A] {
+ def size = Map.this.size;
+ def contains(key : A) = Map.this.contains(key);
+ def elements = Map.this.elements.map(._1);
+ }
+
/** Does this map contain a mapping from the given key to a value?
*
* @param key the key