@@ -687,12 +687,12 @@ object PatternMatcher {
687
687
val refCount = varRefCount(plan)
688
688
val LetPlan (topSym, _) = plan
689
689
690
- def toDrop (sym : Symbol ) =
691
- initializer.contains(sym) &&
692
- isPatmatGenerated(sym) &&
693
- refCount(sym) <= 1 &&
694
- sym != topSym &&
695
- isPureExpr(initializer(sym))
690
+ def toDrop (sym : Symbol ) = initializer.get(sym) match {
691
+ case Some (rhs) =>
692
+ isPatmatGenerated(sym) && refCount(sym) <= 1 && sym != topSym && isPureExpr(rhs)
693
+ case none =>
694
+ false
695
+ }
696
696
697
697
object Inliner extends PlanTransform {
698
698
override val treeMap = new TreeMap {
@@ -924,10 +924,11 @@ object PatternMatcher {
924
924
def translateMatch (tree : Match ): Tree = {
925
925
var plan = matchPlan(tree)
926
926
patmatch.println(i " Plan for $tree: ${show(plan)}" )
927
- for ((title, optimization) <- optimizations) {
928
- plan = optimization(plan)
929
- patmatch.println(s " After $title: ${show(plan)}" )
930
- }
927
+ if (! ctx.settings.YnoPatmatOpt .value)
928
+ for ((title, optimization) <- optimizations) {
929
+ plan = optimization(plan)
930
+ patmatch.println(s " After $title: ${show(plan)}" )
931
+ }
931
932
val result = emit(plan)
932
933
checkSwitch(tree, result)
933
934
result
0 commit comments