diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-09-11 10:17:02 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-09-11 10:22:23 +0200 |
commit | 2c9e051b0c152d6dbc19d3bdad6ed60c096df213 (patch) | |
tree | 04114b4ff5b5fdc6d9952d8354e32eaf6fbae9c9 /src | |
parent | 3707b09aa405150b5064fb2490dbd2632923ed16 (diff) | |
download | scala-2c9e051b0c152d6dbc19d3bdad6ed60c096df213.tar.gz scala-2c9e051b0c152d6dbc19d3bdad6ed60c096df213.tar.bz2 scala-2c9e051b0c152d6dbc19d3bdad6ed60c096df213.zip |
Revert a tiny recent refactoring in SelectiveCPSTransform
The refactoring in 7e6c723df means that we can't build the CPS
plugin if we skip locker in development mode.
This commit backs out the refactoring and leaves a TODO comment
to perform it at a later date.
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 => |