diff options
author | David MacIver <david.maciver@gmail.com> | 2008-11-04 14:56:08 +0000 |
---|---|---|
committer | David MacIver <david.maciver@gmail.com> | 2008-11-04 14:56:08 +0000 |
commit | e6f0eb6e1ba6c5db5555b0b5aad6cecdf936a2d5 (patch) | |
tree | 7d527aec072be7fbaa988561ed668c345efbf9cb /src/compiler | |
parent | 79997446834008008c30d9b0c3292516f84b04d6 (diff) | |
download | scala-e6f0eb6e1ba6c5db5555b0b5aad6cecdf936a2d5.tar.gz scala-e6f0eb6e1ba6c5db5555b0b5aad6cecdf936a2d5.tar.bz2 scala-e6f0eb6e1ba6c5db5555b0b5aad6cecdf936a2d5.zip |
Stripping out casetags.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/Settings.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/matching/ParallelMatching.scala | 56 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/matching/TransMatcher.scala | 1 |
3 files changed, 0 insertions, 59 deletions
diff --git a/src/compiler/scala/tools/nsc/Settings.scala b/src/compiler/scala/tools/nsc/Settings.scala index 93734b379d..add169ad53 100644 --- a/src/compiler/scala/tools/nsc/Settings.scala +++ b/src/compiler/scala/tools/nsc/Settings.scala @@ -152,8 +152,6 @@ class Settings(error: String => Unit) { val Xwarndeadcode = BooleanSetting ("-Ywarn-dead-code", "Emit warnings for dead code") val Ynogenericsig = BooleanSetting ("-Yno-generic-signatures", "Suppress generation of generic signatures for Java") - val Xcasetags = ChoiceSetting("-Ycasetags", "test integer tags for case classes", List("on","off"), - /*default*/"off").hideToIDE val XnoVarargsConversion = BooleanSetting("-Xno-varargs-conversion", "disable varags conversion") val selfInAnnots = BooleanSetting ("-Yself-in-annots", "Include a \"self\" identifier inside of annotations") diff --git a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala index fec4c10d8f..baa849d928 100644 --- a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala +++ b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala @@ -97,7 +97,6 @@ trait ParallelMatching { 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) } @@ -183,61 +182,6 @@ trait ParallelMatching { (tagIndicesToReps, defaultV, if (haveDefault) Some(defaultsToRep) else None) } - /** mixture rule for flat case class (using tags) - * this rule gets translated to a switch of _.$tag() - **/ - class MixCases(val scrutinee:Symbol, val column:List[Tree], val rest:Rep)(implicit rep:RepFactory) extends CaseRuleApplication(rep) { - - /** insert row indices into list of tagIndices */ - for ((x, i) <- column.zipWithIndex; val p = strip2(x)) - if (isDefaultPattern(p)) - insertDefault(i, strip1(x)) - else - insertTagIndexPair(p.tpe.typeSymbol.tag, i) - - override def grabTemps = scrutinee::rest.temp - - override def grabRow(index: Int) = { - val firstValue = tagIndices(tagIndices.firstKey).head - val r @ Row(_,s,_,_) = rest.row(firstValue) - val nbindings = s.add(strip1(column(index)), scrutinee) - - r.insert2(List(column(firstValue)), nbindings) - } - - final def tree(implicit theOwner: Symbol, failTree: Tree): Tree = { - val (branches, defaultV, defaultRep) = getTransition // tag body pairs - val isSealed = scrutinee.tpe.typeSymbol hasFlag Flags.SEALED - val cases: List[CaseDef] = for ((tag, r) <- branches) yield { - val pat = column(tagIndices(tag).head) - val t2 = strip2(pat) match { - case _: Apply if isSealed => - val vtmp = newVar(pat.pos, pat.tpe) - squeezedBlock( - List(typedValDef(vtmp, gen.mkAsInstanceOf(mkIdent(this.scrutinee), pat.tpe))), - repToTree(rep.make(vtmp :: r.temp.tail, r.row)) - ) - case _ => repToTree(r) - } - - CaseDef(Literal(tag), EmptyTree, t2) - } - - // make first case a default case. - lazy val ndefault: Tree = defaultRep.map(repToTree) getOrElse failTree - lazy val defCase: CaseDef = CaseDef(mk_(definitions.IntClass.tpe), EmptyTree, ndefault) - val (first, rest) = - if (isSealed && defaultV.isEmpty) (cases.head.body, cases.tail) - else (ndefault, cases) - - rest match { - case Nil => ndefault - case CaseDef(lit,_,body) :: Nil => If(Equals(Select(mkIdent(this.scrutinee), nme.tag), lit), body, ndefault) - case _ => Match(Select(mkIdent(this.scrutinee), nme.tag), cases ::: List(defCase)) - } - } - } - /** mixture rule for literals */ class MixLiterals(val scrutinee:Symbol, val column:List[Tree], val rest:Rep)(implicit rep:RepFactory) extends CaseRuleApplication(rep) { diff --git a/src/compiler/scala/tools/nsc/matching/TransMatcher.scala b/src/compiler/scala/tools/nsc/matching/TransMatcher.scala index c71874fe8e..2772cb5edb 100644 --- a/src/compiler/scala/tools/nsc/matching/TransMatcher.scala +++ b/src/compiler/scala/tools/nsc/matching/TransMatcher.scala @@ -24,7 +24,6 @@ trait TransMatcher { self: transform.ExplicitOuter with PatternNodes with Parall // cache these final val settings_debug = settings.debug.value final val settings_squeeze = settings.Xsqueeze.value == "on" - final val settings_casetags = settings.Xcasetags.value == "on" // check special case Seq(p1,...,pk,_*) protected def isRightIgnoring(p: ArrayValue): Boolean = { |