summaryrefslogtreecommitdiff
path: root/src/continuations
diff options
context:
space:
mode:
authorphaller <philipp.haller@typesafe.com>2012-06-15 17:04:54 +0200
committerphaller <philipp.haller@typesafe.com>2012-06-15 17:04:54 +0200
commit0ada0706746c9c603bf5bc8a0e6780e5783297cf (patch)
tree47b0a00922d10dbb928aae3b68ded3a9da47bfb4 /src/continuations
parent51c92f02229098d0b402a65a72267f7a17984022 (diff)
downloadscala-0ada0706746c9c603bf5bc8a0e6780e5783297cf.tar.gz
scala-0ada0706746c9c603bf5bc8a0e6780e5783297cf.tar.bz2
scala-0ada0706746c9c603bf5bc8a0e6780e5783297cf.zip
Remove unneeded use of Tree#id
Diffstat (limited to 'src/continuations')
-rw-r--r--src/continuations/plugin/scala/tools/selectivecps/CPSUtils.scala28
-rw-r--r--src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala4
2 files changed, 16 insertions, 16 deletions
diff --git a/src/continuations/plugin/scala/tools/selectivecps/CPSUtils.scala b/src/continuations/plugin/scala/tools/selectivecps/CPSUtils.scala
index 1f5ccd3d09..765cde5a81 100644
--- a/src/continuations/plugin/scala/tools/selectivecps/CPSUtils.scala
+++ b/src/continuations/plugin/scala/tools/selectivecps/CPSUtils.scala
@@ -138,38 +138,38 @@ trait CPSUtils {
}
def isTailReturn(retExpr: Tree, body: Tree): Boolean = {
- val removedIds = ListBuffer[Int]()
- removeTailReturn(body, removedIds)
- removedIds contains retExpr.id
+ val removed = ListBuffer[Tree]()
+ removeTailReturn(body, removed)
+ removed contains retExpr
}
- def removeTailReturn(tree: Tree, ids: ListBuffer[Int]): Tree = tree match {
+ def removeTailReturn(tree: Tree, removed: ListBuffer[Tree]): Tree = tree match {
case Block(stms, r @ Return(expr)) =>
- ids += r.id
+ removed += r
treeCopy.Block(tree, stms, expr)
case Block(stms, expr) =>
- treeCopy.Block(tree, stms, removeTailReturn(expr, ids))
+ treeCopy.Block(tree, stms, removeTailReturn(expr, removed))
case If(cond, r1 @ Return(thenExpr), r2 @ Return(elseExpr)) =>
- ids ++= Seq(r1.id, r2.id)
- treeCopy.If(tree, cond, removeTailReturn(thenExpr, ids), removeTailReturn(elseExpr, ids))
+ removed ++= Seq(r1, r2)
+ treeCopy.If(tree, cond, removeTailReturn(thenExpr, removed), removeTailReturn(elseExpr, removed))
case If(cond, thenExpr, elseExpr) =>
- treeCopy.If(tree, cond, removeTailReturn(thenExpr, ids), removeTailReturn(elseExpr, ids))
+ treeCopy.If(tree, cond, removeTailReturn(thenExpr, removed), removeTailReturn(elseExpr, removed))
case Try(block, catches, finalizer) =>
treeCopy.Try(tree,
- removeTailReturn(block, ids),
- (catches map (t => removeTailReturn(t, ids))).asInstanceOf[List[CaseDef]],
- removeTailReturn(finalizer, ids))
+ removeTailReturn(block, removed),
+ (catches map (t => removeTailReturn(t, removed))).asInstanceOf[List[CaseDef]],
+ removeTailReturn(finalizer, removed))
case CaseDef(pat, guard, r @ Return(expr)) =>
- ids += r.id
+ removed += r
treeCopy.CaseDef(tree, pat, guard, expr)
case CaseDef(pat, guard, body) =>
- treeCopy.CaseDef(tree, pat, guard, removeTailReturn(body, ids))
+ treeCopy.CaseDef(tree, pat, guard, removeTailReturn(body, removed))
case _ =>
tree
diff --git a/src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala b/src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala
index e02e02d975..fe465aad0d 100644
--- a/src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala
+++ b/src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala
@@ -52,12 +52,12 @@ abstract class SelectiveANFTransform extends PluginComponent with Transform with
debuglog("transforming " + dd.symbol)
atOwner(dd.symbol) {
- val tailReturns = ListBuffer[Int]()
+ val tailReturns = ListBuffer[Tree]()
val rhs = removeTailReturn(rhs0, tailReturns)
// throw an error if there is a Return tree which is not in tail position
rhs0 foreach {
case r @ Return(_) =>
- if (!tailReturns.contains(r.id))
+ if (!tailReturns.contains(r))
unit.error(r.pos, "return expressions in CPS code must be in tail position")
case _ => /* do nothing */
}