@@ -23,7 +23,7 @@ trait CompilationUnits { self: Global =>
23
23
/** One unit of compilation that has been submitted to the compiler.
24
24
* It typically corresponds to a single file of source code. It includes
25
25
* error-reporting hooks. */
26
- class CompilationUnit (val source : SourceFile ) extends CompilationUnitContextApi {
26
+ class CompilationUnit (val source : SourceFile ) extends CompilationUnitContextApi { self =>
27
27
28
28
/** the fresh name creator */
29
29
var fresh : FreshNameCreator = new FreshNameCreator .Default
@@ -57,7 +57,23 @@ trait CompilationUnits { self: Global =>
57
57
58
58
/** Synthetic definitions generated by namer, eliminated by typer.
59
59
*/
60
- val synthetics = mutable.HashMap [Symbol , Tree ]()
60
+ object synthetics {
61
+ private val map = mutable.HashMap [Symbol , Tree ]()
62
+ def update (sym : Symbol , tree : Tree ) {
63
+ debuglog(s " adding synthetic ( $sym, $tree) to $self" )
64
+ map.update(sym, tree)
65
+ }
66
+ def -= (sym : Symbol ) {
67
+ debuglog(s " removing synthetic $sym from $self" )
68
+ map -= sym
69
+ }
70
+ def get (sym : Symbol ): Option [Tree ] = logResultIf[Option [Tree ]](s " found synthetic for $sym in $self" , _.isDefined) {
71
+ map get sym
72
+ }
73
+ def keys : Iterable [Symbol ] = map.keys
74
+ def clear (): Unit = map.clear()
75
+ override def toString = map.toString
76
+ }
61
77
62
78
/** things to check at end of compilation unit */
63
79
val toCheck = new ListBuffer [() => Unit ]
0 commit comments