aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-04-05 23:12:58 +0200
committerJason Zaugg <jzaugg@gmail.com>2014-04-05 23:12:58 +0200
commit92ab5b74abcff8b49a408f4bf46c285c0016a44b (patch)
tree45d6288e890897045348b6b7b084c54626a3daba /src
parent93898302564456f453a0cd283c89030a2b783e7f (diff)
downloadscala-async-92ab5b74abcff8b49a408f4bf46c285c0016a44b.tar.gz
scala-async-92ab5b74abcff8b49a408f4bf46c285c0016a44b.tar.bz2
scala-async-92ab5b74abcff8b49a408f4bf46c285c0016a44b.zip
Refactoring in ANFTransform
- simpler means to calculate `applyDepth` - remove unused binder
Diffstat (limited to 'src')
-rw-r--r--src/main/scala/scala/async/internal/AnfTransform.scala17
1 files changed, 2 insertions, 15 deletions
diff --git a/src/main/scala/scala/async/internal/AnfTransform.scala b/src/main/scala/scala/async/internal/AnfTransform.scala
index a0f722f..e54eb54 100644
--- a/src/main/scala/scala/async/internal/AnfTransform.scala
+++ b/src/main/scala/scala/async/internal/AnfTransform.scala
@@ -161,7 +161,7 @@ private[async] trait AnfTransform {
val stats :+ expr1 = linearize.transformToList(expr)
stats :+ treeCopy.Typed(tree, expr1, tpt)
- case ap @ Applied(fun, targs, argss) if argss.nonEmpty =>
+ case Applied(fun, targs, argss) if argss.nonEmpty =>
// we can assume that no await call appears in a by-name argument position,
// this has already been checked.
val funStats :+ simpleFun = linearize.transformToList(fun)
@@ -188,20 +188,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)
- case TypeApply(fn, _) => loop(fn)
- case AppliedTypeTree(fn, _) => loop(fn)
- case _ => 0
- }
- loop(tree)
- }
-
- val typedNewApply = copyApplied(tree, applyDepth)
+ val typedNewApply = copyApplied(tree, argss.length)
funStats ++ argStatss.flatten.flatten :+ typedNewApply