diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSTransform.scala | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSTransform.scala b/src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSTransform.scala index a2c2ebc3e3..0210ad3459 100644 --- a/src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSTransform.scala +++ b/src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSTransform.scala @@ -330,6 +330,10 @@ abstract class SelectiveCPSTransform extends PluginComponent with } } + // TODO use gen.mkBlock after 2.11.0-M6. Why wait? It allows us to still build in development + // mode with `ant -DskipLocker=1` + def mkBlock(stms: List[Tree], expr: Tree) = if (stms.nonEmpty) Block(stms, expr) else expr + try { if (specialCaseTrivial) { debuglog("will optimize possible tail call: " + bodyExpr) @@ -348,9 +352,9 @@ abstract class SelectiveCPSTransform extends PluginComponent with val argSym = currentOwner.newValue(vd.symbol.name.toTermName).setInfo(tpe) val argDef = localTyper.typed(ValDef(argSym, Select(ctxRef, ctxRef.tpe.member(cpsNames.getTrivialValue)))) val switchExpr = localTyper.typedPos(vd.symbol.pos) { - val body2 = gen.mkBlock(bodyStms :+ bodyExpr).duplicate // dup before typing! + val body2 = mkBlock(bodyStms, bodyExpr).duplicate // dup before typing! If(Select(ctxRef, ctxSym.tpe.member(cpsNames.isTrivial)), - applyTrivial(argSym, gen.mkBlock((argDef :: bodyStms) :+ bodyExpr)), + applyTrivial(argSym, mkBlock(argDef::bodyStms, bodyExpr)), applyCombinatorFun(ctxRef, body2)) } (List(ctxDef), switchExpr) @@ -358,7 +362,7 @@ abstract class SelectiveCPSTransform extends PluginComponent with // ctx.flatMap { <lhs> => ... } // or // ctx.map { <lhs> => ... } - (Nil, applyCombinatorFun(rhs1, gen.mkBlock(bodyStms :+ bodyExpr))) + (Nil, applyCombinatorFun(rhs1, mkBlock(bodyStms, bodyExpr))) } } catch { case ex:TypeError => |