summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/transform/TailCalls.scala
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2006-07-26 15:43:04 +0000
committerIulian Dragos <jaguarul@gmail.com>2006-07-26 15:43:04 +0000
commit5b74d5d55589d07d07ae7a14e6adba723d360084 (patch)
treead4fb9cff1b49da141fadde640d8ddf5a269f2ad /src/compiler/scala/tools/nsc/transform/TailCalls.scala
parent1ab39df4af59ddd4409c3638216e266a0615c9ee (diff)
downloadscala-5b74d5d55589d07d07ae7a14e6adba723d360084.tar.gz
scala-5b74d5d55589d07d07ae7a14e6adba723d360084.tar.bz2
scala-5b74d5d55589d07d07ae7a14e6adba723d360084.zip
Added -g detailed option.
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/TailCalls.scala')
-rw-r--r--src/compiler/scala/tools/nsc/transform/TailCalls.scala20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/TailCalls.scala b/src/compiler/scala/tools/nsc/transform/TailCalls.scala
index c2681b2d3b..ccd1acebca 100644
--- a/src/compiler/scala/tools/nsc/transform/TailCalls.scala
+++ b/src/compiler/scala/tools/nsc/transform/TailCalls.scala
@@ -21,6 +21,17 @@ abstract class TailCalls extends Transform
val phaseName: String = "tailcalls";
def newTransformer(unit: CompilationUnit): Transformer = new TailCallElimination(unit);
+ /** Create a new phase which applies transformer */
+ override def newPhase(prev: scala.tools.nsc.Phase): StdPhase = new Phase(prev);
+
+ /** The phase defined by this transform */
+ class Phase(prev: scala.tools.nsc.Phase) extends StdPhase(prev) {
+ def apply(unit: global.CompilationUnit): unit = if (!(settings.debuginfo.value == "notc")) {
+ newTransformer(unit).transformUnit(unit);
+ }
+ }
+
+
/**
* A Tail Call Transformer
*
@@ -138,8 +149,6 @@ abstract class TailCalls extends Transform
newCtx.tparams = tparams map (.symbol);
newCtx.label.setInfo(
restpe.substSym(tpes, tparams map (.symbol)));
- log("adding types: " + newCtx.tparams);
- log("setting return resultType to: " + newCtx.label.tpe);
case _ => ();
}
@@ -156,8 +165,6 @@ abstract class TailCalls extends Transform
} else
copy.DefDef(tree, mods, name, tparams, vparams, tpt, newRHS);
} else {
- log("Non-final method: " + name);
- // Martin: OK like that?
copy.DefDef(tree, mods, name, tparams, vparams, tpt, transform(rhs, newCtx))
}
log("Leaving DefDef: " + name);
@@ -199,7 +206,9 @@ abstract class TailCalls extends Transform
case If(cond, thenp, elsep) =>
copy.If(tree, cond, transform(thenp), transform(elsep));
- case Match(selector, cases) => super.transform(tree);
+ case Match(selector, cases) => //super.transform(tree);
+ copy.Match(tree, transform(selector, mkContext(ctx, false)), transformTrees(cases).asInstanceOf[List[CaseDef]]);
+
case Return(expr) => super.transform(tree);
case Try(block, catches, finalizer) => super.transform(tree);
@@ -258,7 +267,6 @@ abstract class TailCalls extends Transform
private def isSameTypes(ts1: List[Symbol], ts2: List[Symbol]): Boolean = {
def isSameType(t1: Symbol, t2: Symbol) = {
- log("" + t1 + " vs " + t2);
t1 == t2
}
List.forall2(ts1, ts2)(isSameType)