summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2008-08-08 09:59:26 +0000
committerIulian Dragos <jaguarul@gmail.com>2008-08-08 09:59:26 +0000
commit2d445ad1afe66b8b8fb9139c43f29605eb5a0877 (patch)
tree09960dee71dc209340bccc06b5d1cdb64133c214 /src
parentaa1f5a76e4b16035328444cd12e3bc35cc864b09 (diff)
downloadscala-2d445ad1afe66b8b8fb9139c43f29605eb5a0877.tar.gz
scala-2d445ad1afe66b8b8fb9139c43f29605eb5a0877.tar.bz2
scala-2d445ad1afe66b8b8fb9139c43f29605eb5a0877.zip
Fixed tail-call related issues.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/transform/TailCalls.scala10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/TailCalls.scala b/src/compiler/scala/tools/nsc/transform/TailCalls.scala
index 4ab49b68cc..8c582b1756 100644
--- a/src/compiler/scala/tools/nsc/transform/TailCalls.scala
+++ b/src/compiler/scala/tools/nsc/transform/TailCalls.scala
@@ -236,12 +236,10 @@ abstract class TailCalls extends Transform
case Return(expr) => super.transform(tree)
case Try(block, catches, finalizer) =>
- if (finalizer == EmptyTree)
- super.transform(tree)
- else
- copy.Try(tree, transform(block, mkContext(ctx, false)), // recursive calls are not in tail position if there is non-empty finally clause
- transformTrees(catches, ctx).asInstanceOf[List[CaseDef]],
- transform(finalizer, ctx))
+ // no calls inside try are in tail position, but keep recursing for more nested functions
+ copy.Try(tree, transform(block, mkContext(ctx, false)),
+ transformTrees(catches, mkContext(ctx, false)).asInstanceOf[List[CaseDef]],
+ transform(finalizer, mkContext(ctx, false)))
case Throw(expr) => super.transform(tree)
case New(tpt) => super.transform(tree)