diff options
author | Paul Phillips <paulp@improving.org> | 2013-06-08 12:04:27 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-06-08 12:04:27 -0700 |
commit | 45d61774eb255416c96e983cdb87960ad6415b74 (patch) | |
tree | 4aeb3debc1cf0a79ece22175f4be8450b607594b /src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala | |
parent | 04837e710552cc53b0b06b2bc47ee7d2856ae230 (diff) | |
download | scala-45d61774eb255416c96e983cdb87960ad6415b74.tar.gz scala-45d61774eb255416c96e983cdb87960ad6415b74.tar.bz2 scala-45d61774eb255416c96e983cdb87960ad6415b74.zip |
Eliminate needless Options.
Many of our core types have dedicated sentinels which serve
perfectly to communicate "no value", even more perfectly than
None. Saving a billion allocations is gravy.
Diffstat (limited to 'src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala index fb927d15d3..fa7279f6ef 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala @@ -39,7 +39,7 @@ abstract class ClassfileParser { protected var isScala: Boolean = _ // does class file describe a scala class? protected var isScalaAnnot: Boolean = _ // does class file describe a scala class with its pickled info in an annotation? protected var isScalaRaw: Boolean = _ // this class file is a scala class with no pickled info - protected var busy: Option[Symbol] = None // lock to detect recursive reads + protected var busy: Symbol = _ // lock to detect recursive reads protected var currentClass: Name = _ // JVM name of the current class protected var classTParams = Map[Name,Symbol]() protected var srcfile0 : Option[AbstractFile] = None @@ -90,16 +90,15 @@ abstract class ClassfileParser { case e: RuntimeException => handleError(e) } @inline private def pushBusy[T](sym: Symbol)(body: => T): T = { - busy match { - case Some(`sym`) => throw new IOException(s"unsatisfiable cyclic dependency in '$sym'") - case Some(sym1) => throw new IOException(s"illegal class file dependency between '$sym' and '$sym1'") - case _ => () - } + if (busy eq sym) + throw new IOException(s"unsatisfiable cyclic dependency in '$sym'") + else if ((busy ne null) && (busy ne NoSymbol)) + throw new IOException(s"illegal class file dependency between '$sym' and '$busy'") - busy = Some(sym) + busy = sym try body catch parseErrorHandler - finally busy = None + finally busy = NoSymbol } @inline private def raiseLoaderLevel[T](body: => T): T = { loaders.parentsLevel += 1 |