diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-08-08 08:52:31 +0200 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-08-08 08:52:31 +0200 |
commit | 0ea83a289e80c973e42810aee83e0f4a7102fee5 (patch) | |
tree | 12283d2855c3d66f67e7c80939bb39e15af9a449 /src/compiler/scala/tools/nsc/ast/TreeGen.scala | |
parent | 1241e40ed4442abd635f44ce997013268b956b4b (diff) | |
parent | 45d045f8e3d7006890c5a3a187b8b2fc262ad5c7 (diff) | |
download | scala-0ea83a289e80c973e42810aee83e0f4a7102fee5.tar.gz scala-0ea83a289e80c973e42810aee83e0f4a7102fee5.tar.bz2 scala-0ea83a289e80c973e42810aee83e0f4a7102fee5.zip |
Merge branch '2.10.x'
Conflicts:
src/compiler/scala/tools/nsc/ast/TreeGen.scala
src/compiler/scala/tools/nsc/settings/AestheticSettings.scala
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/TreeGen.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/TreeGen.scala | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/TreeGen.scala b/src/compiler/scala/tools/nsc/ast/TreeGen.scala index 75852d4f2f..d7352045f5 100644 --- a/src/compiler/scala/tools/nsc/ast/TreeGen.scala +++ b/src/compiler/scala/tools/nsc/ast/TreeGen.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ @@ -72,8 +72,6 @@ abstract class TreeGen extends reflect.internal.TreeGen with TreeDSL { Annotated(Ident(nme.synthSwitch), expr) } - def hasSynthCaseSymbol(t: Tree) = (t.symbol ne null) && (t.symbol hasFlag (CASE | SYNTHETIC)) - // TODO: would be so much nicer if we would know during match-translation (i.e., type checking) // whether we should emit missingCase-style apply (and isDefinedAt), instead of transforming trees post-factum class MatchMatcher { @@ -94,13 +92,13 @@ abstract class TreeGen extends reflect.internal.TreeGen with TreeDSL { case Apply(Apply(TypeApply(Select(tgt, nme.runOrElse), targs), List(scrut)), List(matcher)) if !settings.XoldPatmat.value => // println("virt match: "+ (tgt, targs, scrut, matcher) + "for:\n"+ matchExpr ) caseVirtualizedMatch(matchExpr, tgt, targs, scrut, matcher) // optimized version of virtpatmat - case Block(stats, matchEndDef) if !settings.XoldPatmat.value && (stats forall hasSynthCaseSymbol) => + case Block(stats, matchEndDef) if !settings.XoldPatmat.value && (stats forall treeInfo.hasSynthCaseSymbol) => // the assumption is once we encounter a case, the remainder of the block will consist of cases // the prologue may be empty, usually it is the valdef that stores the scrut val (prologue, cases) = stats span (s => !s.isInstanceOf[LabelDef]) caseVirtualizedMatchOpt(matchExpr, prologue, cases, matchEndDef, identity) // optimized version of virtpatmat - case Block(outerStats, orig@Block(stats, matchEndDef)) if !settings.XoldPatmat.value && (stats forall hasSynthCaseSymbol) => + case Block(outerStats, orig@Block(stats, matchEndDef)) if !settings.XoldPatmat.value && (stats forall treeInfo.hasSynthCaseSymbol) => val (prologue, cases) = stats span (s => !s.isInstanceOf[LabelDef]) caseVirtualizedMatchOpt(matchExpr, prologue, cases, matchEndDef, m => copyBlock(matchExpr, outerStats, m)) case other => |