aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/scala/async/internal/AnfTransform.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/scala/async/internal/AnfTransform.scala')
-rw-r--r--src/main/scala/scala/async/internal/AnfTransform.scala11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/main/scala/scala/async/internal/AnfTransform.scala b/src/main/scala/scala/async/internal/AnfTransform.scala
index d879c7b..bf66fde 100644
--- a/src/main/scala/scala/async/internal/AnfTransform.scala
+++ b/src/main/scala/scala/async/internal/AnfTransform.scala
@@ -73,7 +73,7 @@ private[async] trait AnfTransform {
expr match {
case Apply(fun, args) if isAwait(fun) =>
val valDef = defineVal(name.await, expr, tree.pos)
- stats :+ valDef :+ gen.mkAttributedStableRef(valDef.symbol).setType(tree.tpe).setPos(tree.pos)
+ stats :+ valDef :+ atPos(tree.pos)(gen.mkAttributedStableRef(valDef.symbol)).setType(tree.tpe)
case If(cond, thenp, elsep) =>
// if type of if-else is Unit don't introduce assignment,
@@ -90,7 +90,7 @@ private[async] trait AnfTransform {
}
}
val ifWithAssign = treeCopy.If(tree, cond, branchWithAssign(thenp), branchWithAssign(elsep)).setType(definitions.UnitTpe)
- stats :+ varDef :+ ifWithAssign :+ gen.mkAttributedStableRef(varDef.symbol).setType(tree.tpe).setPos(tree.pos)
+ stats :+ varDef :+ ifWithAssign :+ atPos(tree.pos)(gen.mkAttributedStableRef(varDef.symbol).setType(tree.tpe))
}
case LabelDef(name, params, rhs) =>
statsExprUnit
@@ -115,7 +115,7 @@ private[async] trait AnfTransform {
}
val matchWithAssign = treeCopy.Match(tree, scrut, casesWithAssign).setType(definitions.UnitTpe)
require(matchWithAssign.tpe != null, matchWithAssign)
- stats :+ varDef :+ matchWithAssign :+ gen.mkAttributedStableRef(varDef.symbol).setPos(tree.pos).setType(tree.tpe)
+ stats :+ varDef :+ matchWithAssign :+ atPos(tree.pos)(gen.mkAttributedStableRef(varDef.symbol))
}
case _ =>
stats :+ expr
@@ -124,7 +124,7 @@ private[async] trait AnfTransform {
private def defineVar(prefix: String, tp: Type, pos: Position): ValDef = {
val sym = currOwner.newTermSymbol(name.fresh(prefix), pos, MUTABLE | SYNTHETIC).setInfo(uncheckedBounds(tp))
- ValDef(sym, gen.mkZero(uncheckedBounds(tp))).setType(NoType).setPos(pos)
+ ValDef(sym, mkZero(uncheckedBounds(tp))).setType(NoType).setPos(pos)
}
}
@@ -150,7 +150,6 @@ private[async] trait AnfTransform {
private def defineVal(prefix: String, lhs: Tree, pos: Position): ValDef = {
val sym = currOwner.newTermSymbol(name.fresh(prefix), pos, SYNTHETIC).setInfo(uncheckedBounds(lhs.tpe))
- changeOwner(lhs, currentOwner, sym)
ValDef(sym, changeOwner(lhs, currentOwner, sym)).setType(NoType).setPos(pos)
}
@@ -213,7 +212,7 @@ private[async] trait AnfTransform {
/** The depth of the nested applies: e.g. Apply(Apply(Apply(_, _), _), _)
* has depth 3. Continues through type applications (without counting them.)
- */
+ */
def applyDepth: Int = {
def loop(tree: Tree): Int = tree match {
case Apply(fn, _) => 1 + loop(fn)