@@ -107,9 +107,7 @@ private[async] final case class AnfTransform[C <: Context](c: C) {
107
107
indent += 1
108
108
def oneLine (s : Any ) = s.toString.replaceAll( """ \n""" , " \\\\ n" ).take(127 )
109
109
try {
110
- AsyncUtils .trace(s " ${
111
- indentString
112
- }$prefix( ${oneLine(args)}) " )
110
+ AsyncUtils .trace(s " ${indentString}$prefix( ${oneLine(args)}) " )
113
111
val result = t
114
112
AsyncUtils .trace(s " ${indentString}= ${oneLine(result)}" )
115
113
result
@@ -193,19 +191,19 @@ private[async] final case class AnfTransform[C <: Context](c: C) {
193
191
val stats :+ expr = inline.transformToList(qual)
194
192
stats :+ attachCopy(tree)(Select (expr, sel).setSymbol(tree.symbol))
195
193
196
- case utils. Applied (fun, targs, argss @ (args :: rest)) if containsAwait =>
194
+ case Applied (fun, targs, argss) if argss.nonEmpty && containsAwait =>
197
195
// we an assume that no await call appears in a by-name argument position,
198
196
// this has already been checked.
199
197
val funStats :+ simpleFun = inline.transformToList(fun)
200
198
def isAwaitRef (name : Name ) = name.toString.startsWith(utils.name.await + " $" )
201
199
val (argStatss, argExprss): (List [List [List [Tree ]]], List [List [Tree ]]) =
202
200
mapArgumentss[List [Tree ]](fun, argss) {
203
- case arg if arg.isByName || isSafeToInline(arg. expr) => (Nil , arg. expr)
204
- case Arg (arg @ Ident (name), _, _) if isAwaitRef(name) => (Nil , arg ) // not typed, so it eludes the check in `isSafeToInline`
205
- case arg =>
206
- inline .transformToList(arg. expr) match {
207
- case stats :+ expr =>
208
- val valDef = defineVal(arg. argName, expr, arg. expr.pos)
201
+ case Arg (expr, byName, _) if byName || isSafeToInline(expr) => (Nil , expr)
202
+ case Arg (expr @ Ident (name), _, _) if isAwaitRef(name) => (Nil , expr ) // not typed, so it eludes the check in `isSafeToInline`
203
+ case Arg (expr, _, argName) =>
204
+ inline .transformToList(expr) match {
205
+ case stats :+ expr1 =>
206
+ val valDef = defineVal(argName, expr1, expr.pos)
209
207
(stats :+ valDef, Ident (valDef.name))
210
208
}
211
209
}
0 commit comments