summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/transform/TailCalls.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-02-28 15:35:08 -0800
committerPaul Phillips <paulp@improving.org>2012-02-28 16:54:14 -0800
commitfc2866efee1bcf17aee18d427ed41e172f440f62 (patch)
tree649322d0c27af4a5d6712bd60af69b5b4a4da2b3 /src/compiler/scala/tools/nsc/transform/TailCalls.scala
parent872c825192b30faa1b20f9cc2b1e3a0adeed8617 (diff)
downloadscala-fc2866efee1bcf17aee18d427ed41e172f440f62.tar.gz
scala-fc2866efee1bcf17aee18d427ed41e172f440f62.tar.bz2
scala-fc2866efee1bcf17aee18d427ed41e172f440f62.zip
Reworking synchronized patch.
Eliminated annotation and custom phase. Kept SYNCHRONIZED flag.
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/TailCalls.scala')
-rw-r--r--src/compiler/scala/tools/nsc/transform/TailCalls.scala27
1 files changed, 2 insertions, 25 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/TailCalls.scala b/src/compiler/scala/tools/nsc/transform/TailCalls.scala
index 39ca60d870..23697a4730 100644
--- a/src/compiler/scala/tools/nsc/transform/TailCalls.scala
+++ b/src/compiler/scala/tools/nsc/transform/TailCalls.scala
@@ -173,29 +173,6 @@ abstract class TailCalls extends Transform {
trees map (t => transform(t, nctx))
}
- /**
- * Transforms methods with synchronized body into synchronized methods
- */
- private def transformSynchronizedMethods(tree: Tree): Tree = {
- def isSelfSynchronized(body: Apply) = body.fun match {
- case TypeApply(fun @ Select(This(_), _), List(TypeTree()))
- if (fun.symbol == Object_synchronized &&
- fun.qualifier.symbol == tree.symbol.enclClass &&
- !tree.symbol.enclClass.isTrait) => true
- case _ => false
- }
-
- tree match {
- case DefDef(mods, name, tparams, vparamss, tpt, rhs @ Apply(_, List(body)))
- if (isSelfSynchronized(rhs)) =>
- val res = treeCopy.DefDef(tree, mods, name, tparams, vparamss, tpt, body)
- res.symbol withAnnotation AnnotationInfo(SynchronizedAttr.tpe, Nil, Nil)
- res
- case _ =>
- tree
- }
- }
-
override def transform(tree: Tree): Tree = {
/** A possibly polymorphic apply to be considered for tail call transformation.
*/
@@ -245,8 +222,8 @@ abstract class TailCalls extends Transform {
else rewriteTailCall(receiver)
}
- transformSynchronizedMethods(tree) match {
- case dd @ DefDef(mods, name, tparams, vparams, tpt, rhs) =>
+ tree match {
+ case dd @ DefDef(_, _, _, vparamss0, _, rhs0) =>
val newCtx = new Context(dd)
debuglog("Considering " + dd.name + " for tailcalls")
val newRHS = transform(rhs0, newCtx)