diff options
author | Tiark Rompf <tiark.rompf@epfl.ch> | 2011-08-23 11:14:53 +0000 |
---|---|---|
committer | Tiark Rompf <tiark.rompf@epfl.ch> | 2011-08-23 11:14:53 +0000 |
commit | a93134b4832e95ff014f162f4cc8667f8136cb7d (patch) | |
tree | 384e33218c272f647d1fa1ad94e87b0d94c05768 /src | |
parent | 80952759fbaaf3a99f6bc0ca528da726b5a438e7 (diff) | |
download | scala-a93134b4832e95ff014f162f4cc8667f8136cb7d.tar.gz scala-a93134b4832e95ff014f162f4cc8667f8136cb7d.tar.bz2 scala-a93134b4832e95ff014f162f4cc8667f8136cb7d.zip |
applying patch provided by Topher, fixes #3501.
Diffstat (limited to 'src')
-rw-r--r-- | src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala b/src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala index 001a1b4b62..8889b75770 100644 --- a/src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala +++ b/src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala @@ -211,12 +211,13 @@ abstract class SelectiveANFTransform extends PluginComponent with Transform with case ldef @ LabelDef(name, params, rhs) => if (hasAnswerTypeAnn(tree.tpe)) { - val sym = currentOwner.newMethod(tree.pos, name)//unit.fresh.newName(tree.pos, "myloopvar") + val sym = currentOwner.newMethod(tree.pos, name) .setInfo(ldef.symbol.info) .setFlag(Flags.SYNTHETIC) val rhs1 = new TreeSymSubstituter(List(ldef.symbol), List(sym)).transform(rhs) val rhsVal = transExpr(rhs1, None, getAnswerTypeAnn(tree.tpe)) + new ChangeOwnerTraverser(currentOwner, sym) traverse rhsVal val stm1 = localTyper.typed(DefDef(sym, rhsVal)) val expr = localTyper.typed(Apply(Ident(sym), List())) @@ -355,6 +356,8 @@ abstract class SelectiveANFTransform extends PluginComponent with Transform with .setFlag(Flags.SYNTHETIC) .setAnnotations(List(AnnotationInfo(MarkerCPSSym.tpe, Nil, Nil))) + new ChangeOwnerTraverser(currentOwner, sym) traverse expr + (stms ::: List(ValDef(sym, expr) setType(NoType)), Ident(sym) setType(valueTpe) setPos(tree.pos), linearize(spc, spcVal)(unit, tree.pos)) |