aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/transform/TailRec.scala
diff options
context:
space:
mode:
authorDmitry Petrashko <dmitry.petrashko@gmail.com>2014-10-28 21:02:42 +0100
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2014-10-30 17:22:14 +0100
commite07e9a3986ec59cab1f0ec2b9b4458fd6a64d8c8 (patch)
tree051fd810ac9f1b690c7e7f1cb56508a2d903ebfd /src/dotty/tools/dotc/transform/TailRec.scala
parent6dcd16ab2040a5a337e78bc77e40228dc9944662 (diff)
downloaddotty-e07e9a3986ec59cab1f0ec2b9b4458fd6a64d8c8.tar.gz
dotty-e07e9a3986ec59cab1f0ec2b9b4458fd6a64d8c8.tar.bz2
dotty-e07e9a3986ec59cab1f0ec2b9b4458fd6a64d8c8.zip
Restructure Try node.
Now Try node always has cases as handlers. In case handler is an Ident of type Throwable => T than it's desugared to a CaseDef during parsing.
Diffstat (limited to 'src/dotty/tools/dotc/transform/TailRec.scala')
-rw-r--r--src/dotty/tools/dotc/transform/TailRec.scala9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/transform/TailRec.scala b/src/dotty/tools/dotc/transform/TailRec.scala
index b3f63bcaf..46028e0fc 100644
--- a/src/dotty/tools/dotc/transform/TailRec.scala
+++ b/src/dotty/tools/dotc/transform/TailRec.scala
@@ -156,9 +156,8 @@ class TailRec extends MiniPhaseTransform with DenotTransformer with FullParamete
def noTailTransform(tree: Tree)(implicit c: Context): Tree =
transform(tree, noTailContext)
-
- def noTailTransforms(trees: List[Tree])(implicit c: Context) =
- trees map (noTailTransform)
+ def noTailTransforms[Tr <: Tree](trees: List[Tr])(implicit c: Context): List[Tr] =
+ trees.map(noTailTransform).asInstanceOf[List[Tr]]
override def transform(tree: Tree)(implicit c: Context): Tree = {
/* A possibly polymorphic apply to be considered for tail call transformation. */
@@ -247,14 +246,14 @@ class TailRec extends MiniPhaseTransform with DenotTransformer with FullParamete
// SI-1672 Catches are in tail position when there is no finalizer
tpd.cpy.Try(tree)(
noTailTransform(tree.expr),
- transformHandlers(tree.handler),
+ transformSub(tree.cases),
EmptyTree
)
}
else {
tpd.cpy.Try(tree)(
noTailTransform(tree.expr),
- noTailTransform(tree.handler),
+ noTailTransforms(tree.cases),
noTailTransform(tree.finalizer)
)
}