summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2010-09-18 17:04:32 +0000
committerMartin Odersky <odersky@gmail.com>2010-09-18 17:04:32 +0000
commitbc3e3c54fba45125f3ab2e27a6add43ceaa8f49e (patch)
tree5b3c8b47908e6576ce53a05853ebf59bd5d64b0d
parent49bdf3cda2095c781effe3b1aac69ad1e1791db7 (diff)
downloadscala-bc3e3c54fba45125f3ab2e27a6add43ceaa8f49e.tar.gz
scala-bc3e3c54fba45125f3ab2e27a6add43ceaa8f49e.tar.bz2
scala-bc3e3c54fba45125f3ab2e27a6add43ceaa8f49e.zip
Better unlocking behavior when exceptions are r...
Better unlocking behavior when exceptions are raised. Review by moors.
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Symbols.scala7
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala7
2 files changed, 9 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
index 8d02a120d3..ab79f735b4 100644
--- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
@@ -27,6 +27,9 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable =>
/** Used for deciding in the IDE whether we can interrupt the compiler */
protected var activeLocks = 0
+ /** Used for debugging only */
+ protected var lockedSyms = collection.immutable.Set[Symbol]()
+
/** Used to keep track of the recursion depth on locked symbols */
private var recursionTable = Map.empty[Symbol, Int]
@@ -718,6 +721,7 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable =>
assert(infos.prev eq null, this.name)
val tp = infos.info
//if (settings.debug.value) System.out.println("completing " + this.rawname + tp.getClass());//debug
+
if ((rawflags & LOCKED) != 0L) { // rolled out once for performance
lock {
setInfo(ErrorType)
@@ -731,9 +735,8 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable =>
try {
phase = phaseOf(infos.validFrom)
tp.complete(this)
- // if (settings.debug.value && runId(validTo) == currentRunId) System.out.println("completed " + this/* + ":" + info*/);//DEBUG
- unlock()
} finally {
+ unlock()
phase = current
}
cnt += 1
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index f793da0c54..52ea62e656 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -358,13 +358,13 @@ trait Typers { self: Analyzer =>
}
}
- def checkNonCyclic(pos: Position, tp: Type, lockedSym: Symbol): Boolean = {
+ def checkNonCyclic(pos: Position, tp: Type, lockedSym: Symbol): Boolean = try {
lockedSym.lock {
throw new TypeError("illegal cyclic reference involving " + lockedSym)
}
- val result = checkNonCyclic(pos, tp)
+ checkNonCyclic(pos, tp)
+ } finally {
lockedSym.unlock()
- result
}
def checkNonCyclic(sym: Symbol) {
@@ -697,6 +697,7 @@ trait Typers { self: Analyzer =>
/** The member with given name of given qualifier tree */
def member(qual: Tree, name: Name) = qual.tpe match {
case ThisType(clazz) if (context.enclClass.owner.hasTransOwner(clazz)) =>
+ // println("member")
qual.tpe.member(name)
case _ =>
if (phase.next.erasedTypes) qual.tpe.member(name)