diff options
author | David MacIver <david.maciver@gmail.com> | 2008-10-26 20:57:30 +0000 |
---|---|---|
committer | David MacIver <david.maciver@gmail.com> | 2008-10-26 20:57:30 +0000 |
commit | 068cd37e08b5b50dc9c8e253b86a7ecc7df85db9 (patch) | |
tree | a3635e6c9ff253f05db89faa50f7251c955b55eb | |
parent | 2f3d17b186ca09fd4205ccd3e16e4eef69b1469c (diff) | |
download | scala-068cd37e08b5b50dc9c8e253b86a7ecc7df85db9.tar.gz scala-068cd37e08b5b50dc9c8e253b86a7ecc7df85db9.tar.bz2 scala-068cd37e08b5b50dc9c8e253b86a7ecc7df85db9.zip |
Switching getDefaultRows over to a defaultRows ...
Switching getDefaultRows over to a defaultRows lazy val.
-rw-r--r-- | src/compiler/scala/tools/nsc/matching/ParallelMatching.scala | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala index c3c6f15edc..7a12f5dd02 100644 --- a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala +++ b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala @@ -157,16 +157,12 @@ trait ParallelMatching { protected var defaults: List[Int] = Nil var defaultV: collection.immutable.Set[Symbol] = emptySymbolSet - var theDefaultRows: List[Row] = null - def getDefaultRows: List[Row] = { - if (theDefaultRows ne null) - return theDefaultRows + lazy val defaultRows: List[Row] = { var res:List[Row] = Nil var ds = defaults; while(ds ne Nil) { res = grabRow(ds.head) :: res ds = ds.tail } - theDefaultRows = res res } @@ -195,7 +191,6 @@ trait ParallelMatching { /** inserts row indices using in to list of tagindexpairs*/ protected def tagIndicesToReps(implicit theOwner: Symbol) = { - val defaultRows = getDefaultRows var trs: List[(Int,Rep)] = Nil var old = tagIndexPairs while (tagIndexPairs ne null) { // collect all with same tag @@ -212,7 +207,7 @@ trait ParallelMatching { trs } - protected def defaultsToRep(implicit theOwner: Symbol) = rep.make(rest.temp, getDefaultRows) + protected def defaultsToRep(implicit theOwner: Symbol) = rep.make(rest.temp, defaultRows) protected def insertTagIndexPair(tag: Int, index: Int) { tagIndexPairs = TagIndexPair.insert(tagIndexPairs, tag, index) } @@ -302,12 +297,8 @@ trait ParallelMatching { protected override def haveDefault: Boolean = !defaultIndexSet.isEmpty - override def getDefaultRows: List[Row] = { - if (theDefaultRows eq null) - theDefaultRows = defaultIndexSet.filter(defaultIndexSet(_)).toList.reverseMap(grabRow) - - theDefaultRows - } + override lazy val defaultRows: List[Row] = + defaultIndexSet.filter(defaultIndexSet(_)).toList.reverseMap(grabRow) var varMap: List[(Int,List[Symbol])] = Nil |