From 9da19f07f16f96a2a55f0b48ec49573137cbca4b Mon Sep 17 00:00:00 2001 From: David MacIver Date: Thu, 30 Oct 2008 00:26:38 +0000 Subject: Minor control flow tinkering. --- .../tools/nsc/matching/ParallelMatching.scala | 23 ++++++++-------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala index c352856c1d..a01e31247d 100644 --- a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala +++ b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala @@ -86,22 +86,15 @@ trait ParallelMatching { } } - if (isEqualsPattern(column.head.tpe)) - new MixEquals(scrutinee, column, rest) - else if (column.head.isInstanceOf[ArrayValue]) { - if (isRightIgnoring(column.head.asInstanceOf[ArrayValue])) - new MixSequenceStar(scrutinee, column, rest) - else - new MixSequence(scrutinee, column, rest) + column.head match { + case x if isEqualsPattern(x.tpe) => new MixEquals(scrutinee, column, rest); + case (x : ArrayValue) => if (isRightIgnoring(x)) new MixSequenceStar(scrutinee, column, rest) + else new MixSequence(scrutinee, column, rest); + case _ if isSimpleSwitch => new MixLiterals(scrutinee, column, rest) + case _ if (settings_casetags && (column.length > 1) && isFlatCases(column)) => new MixCases(scrutinee, column, rest) + case _ if isUnapplyHead() => new MixUnapply(scrutinee, column, rest) + case _ => new MixTypes(scrutinee, column, rest) } - else if (isSimpleSwitch) - new MixLiterals(scrutinee, column, rest) - else if (settings_casetags && (column.length > 1) && isFlatCases(column)) - new MixCases(scrutinee, column, rest) - else if (isUnapplyHead()) - new MixUnapply(scrutinee, column, rest) - else - new MixTypes(scrutinee, column, rest) } sealed abstract class RuleApplication(rep: RepFactory) { -- cgit v1.2.3