summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2012-12-04 11:20:44 +0100
committerJason Zaugg <jzaugg@gmail.com>2012-12-04 11:20:44 +0100
commit65c1ae52799587a1de462419ce8c330ddf58193d (patch)
tree0aa5bacd1c36903ab14d798bd46b44911251ce38
parentfd57069a3a49de1757a518b573a0cd8cb98bbbd5 (diff)
downloadscala-65c1ae52799587a1de462419ce8c330ddf58193d.tar.gz
scala-65c1ae52799587a1de462419ce8c330ddf58193d.tar.bz2
scala-65c1ae52799587a1de462419ce8c330ddf58193d.zip
Adds debug logging for synthetic registration.
Investigatory tools for SI-5877
-rw-r--r--src/compiler/scala/tools/nsc/CompilationUnits.scala20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/CompilationUnits.scala b/src/compiler/scala/tools/nsc/CompilationUnits.scala
index 4e7ba60d5e..355a1fd262 100644
--- a/src/compiler/scala/tools/nsc/CompilationUnits.scala
+++ b/src/compiler/scala/tools/nsc/CompilationUnits.scala
@@ -23,7 +23,7 @@ trait CompilationUnits { self: Global =>
/** One unit of compilation that has been submitted to the compiler.
* It typically corresponds to a single file of source code. It includes
* error-reporting hooks. */
- class CompilationUnit(val source: SourceFile) extends CompilationUnitContextApi {
+ class CompilationUnit(val source: SourceFile) extends CompilationUnitContextApi { self =>
/** the fresh name creator */
var fresh: FreshNameCreator = new FreshNameCreator.Default
@@ -57,7 +57,23 @@ trait CompilationUnits { self: Global =>
/** Synthetic definitions generated by namer, eliminated by typer.
*/
- val synthetics = mutable.HashMap[Symbol, Tree]()
+ object synthetics {
+ private val map = mutable.HashMap[Symbol, Tree]()
+ def update(sym: Symbol, tree: Tree) {
+ debuglog(s"adding synthetic ($sym, $tree) to $self")
+ map.update(sym, tree)
+ }
+ def -=(sym: Symbol) {
+ debuglog(s"removing synthetic $sym from $self")
+ map -= sym
+ }
+ def get(sym: Symbol): Option[Tree] = logResultIf[Option[Tree]](s"found synthetic for $sym in $self", _.isDefined) {
+ map get sym
+ }
+ def keys: Iterable[Symbol] = map.keys
+ def clear(): Unit = map.clear()
+ override def toString = map.toString
+ }
/** things to check at end of compilation unit */
val toCheck = new ListBuffer[() => Unit]