diff options
author | Paul Phillips <paulp@improving.org> | 2010-12-23 16:13:19 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-12-23 16:13:19 +0000 |
commit | 9e261754f2c8480d3b0cdb8d936e04b12c21770d (patch) | |
tree | ce8b6f849d24cadc689766e54c9b230002af9bd9 /src | |
parent | 932694494d556b2802d59e1e342b6036405d0407 (diff) | |
download | scala-9e261754f2c8480d3b0cdb8d936e04b12c21770d.tar.gz scala-9e261754f2c8480d3b0cdb8d936e04b12c21770d.tar.bz2 scala-9e261754f2c8480d3b0cdb8d936e04b12c21770d.zip |
Plugging some leakiness I found in the pattern ...
Plugging some leakiness I found in the pattern matcher. No review.
Diffstat (limited to 'src')
3 files changed, 7 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala index 5b57331684..e20fdd7516 100644 --- a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala +++ b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala @@ -231,10 +231,6 @@ trait ParallelMatching extends ast.TreeDSL /***** Rule Applications *****/ sealed abstract class RuleApplication { - // def isFinal = false - // def body = tree - // def freeVars = (scrut.pv :: rest.tvars).syms - def pmatch: PatternMatch def rest: Rep def cond: Tree @@ -243,7 +239,7 @@ trait ParallelMatching extends ast.TreeDSL lazy val PatternMatch(scrut, patterns) = pmatch lazy val head = pmatch.head - def codegen: Tree = IF (cond) THEN (success) ELSE (failure) + lazy val codegen: Tree = IF (cond) THEN (success) ELSE (failure) def mkFail(xs: List[Row]): Tree = if (xs.isEmpty) failTree diff --git a/src/compiler/scala/tools/nsc/matching/Patterns.scala b/src/compiler/scala/tools/nsc/matching/Patterns.scala index 9594d9a368..26076bc27a 100644 --- a/src/compiler/scala/tools/nsc/matching/Patterns.scala +++ b/src/compiler/scala/tools/nsc/matching/Patterns.scala @@ -263,6 +263,7 @@ trait Patterns extends ast.TreeDSL { object Pattern { // a small tree -> pattern cache private val cache = new collection.mutable.HashMap[Tree, Pattern] + def clear() = cache.clear() def unadorn(x: Tree): Tree = x match { case Typed(expr, _) => unadorn(expr) diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala index 0e7d3d3fc1..6e5a8ac817 100644 --- a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala +++ b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala @@ -511,7 +511,7 @@ abstract class ExplicitOuter extends InfoTransform /** The transformation method for whole compilation units */ override def transformUnit(unit: CompilationUnit) { - atPhase(phase.next) { super.transformUnit(unit) } + atPhase(phase.next)(super.transformUnit(unit)) } } @@ -520,5 +520,9 @@ abstract class ExplicitOuter extends InfoTransform class Phase(prev: scala.tools.nsc.Phase) extends super.Phase(prev) { override val checkable = false + override def run { + super.run + Pattern.clear() // clear the cache + } } } |