summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Namers.scala
diff options
context:
space:
mode:
authorEugene Vigdorchik <eugenevigdorchik@epfl.ch>2011-01-04 14:47:14 +0000
committerEugene Vigdorchik <eugenevigdorchik@epfl.ch>2011-01-04 14:47:14 +0000
commit55d1ee6d8b4061d2c65b8c5e88bd59b4be9c5b5d (patch)
tree1c759ad8240d93ab3861f5ca458aa42f2470bc52 /src/compiler/scala/tools/nsc/typechecker/Namers.scala
parenta87d132bb752858dc5f8ac0d450a33f58dd12cba (diff)
downloadscala-55d1ee6d8b4061d2c65b8c5e88bd59b4be9c5b5d.tar.gz
scala-55d1ee6d8b4061d2c65b8c5e88bd59b4be9c5b5d.tar.bz2
scala-55d1ee6d8b4061d2c65b8c5e88bd59b4be9c5b5d.zip
One more try with the lazy clearing.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Namers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index 5e03c048c7..b245c257fd 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -47,8 +47,10 @@ trait Namers { self: Analyzer =>
// synthetic `copy' (reps `apply', `unapply') methods are added. To compute
// their signatures, the corresponding ClassDef is needed.
// During naming, for each case class module symbol, the corresponding ClassDef
- // is stored in this map.
- private[typechecker] val caseClassOfModuleClass = new HashMap[Symbol, ClassDef]
+ // is stored in this map. The map is cleared lazily, i.e. when the new symbol
+ // is created with the same name, the old one (if present) is wiped out, or the
+ // entry is deleted when it is used and no longer needed.
+ private val caseClassOfModuleClass = new HashMap[Symbol, ClassDef]
// Default getters of constructors are added to the companion object in the
// typeCompleter of the constructor (methodSig). To compute the signature,
@@ -59,7 +61,6 @@ trait Namers { self: Analyzer =>
private[typechecker] val classAndNamerOfModule = new HashMap[Symbol, (ClassDef, Namer)]
def resetNamer() {
- caseClassOfModuleClass.clear
classAndNamerOfModule.clear
}
@@ -203,6 +204,7 @@ trait Namers { self: Analyzer =>
updatePosFlags(c, tree.pos, tree.mods.flags)
setPrivateWithin(tree, c, tree.mods)
} else {
+ caseClassOfModuleClass -= c
var sym = context.owner.newClass(tree.pos, tree.name)
sym = sym.setFlag(tree.mods.flags | inConstructorFlag)
sym = setPrivateWithin(tree, sym, tree.mods)