summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Namers.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2011-04-04 17:35:19 +0000
committerMartin Odersky <odersky@gmail.com>2011-04-04 17:35:19 +0000
commit749739d146e2ecaec00de693f0970d76cb77ff08 (patch)
tree22062f432e9ebd2e4cdf16c32ff7e7f22494c15c /src/compiler/scala/tools/nsc/typechecker/Namers.scala
parent876760c6db304b8d54d05d5b21dfb5e088ef2a24 (diff)
downloadscala-749739d146e2ecaec00de693f0970d76cb77ff08.tar.gz
scala-749739d146e2ecaec00de693f0970d76cb77ff08.tar.bz2
scala-749739d146e2ecaec00de693f0970d76cb77ff08.zip
Some localized code cleanup.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Namers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index f7d8b0d887..f966e1476c 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -783,9 +783,9 @@ trait Namers { self: Analyzer =>
// if default getters (for constructor defaults) need to be added to that module, here's the namer
// to use. clazz is the ModuleClass. sourceModule works also for classes defined in methods.
val module = clazz.sourceModule
- if (classAndNamerOfModule contains module) {
- val (cdef, _) = classAndNamerOfModule(module)
- classAndNamerOfModule(module) = (cdef, templateNamer)
+ classAndNamerOfModule get module match {
+ case Some((cdef, _)) => classAndNamerOfModule(module) = (cdef, templateNamer)
+ case None =>
}
if (opt.verbose) {
@@ -1008,13 +1008,14 @@ trait Namers { self: Analyzer =>
val module = companionModuleOf(meth.owner, context)
module.initialize // call type completer (typedTemplate), adds the
// module's templateNamer to classAndNamerOfModule
- if (!classAndNamerOfModule.contains(module))
- return // fix #3649 (prevent crash in erroneous source code)
- val (cdef, nmr) = classAndNamerOfModule(module)
- if (nmr == null)
- return // can happen in IDE; this is really an ugly hack on top[ of an ugly hack but it seems to work!
- moduleNamer = Some(cdef, nmr)
- (cdef, nmr)
+ classAndNamerOfModule get module match {
+ case s @ Some((cdef, nmr)) if nmr != null =>
+ moduleNamer = s
+ (cdef, nmr)
+ case _ =>
+ return // fix #3649 (prevent crash in erroneous source code)
+ // nmr == null can happen in IDE; this is really an ugly hack on top[ of an ugly hack but it seems to work
+ }
}
deftParams = cdef.tparams map copyUntypedInvariant
nmr