Skip to content

Commit 14ca71d

Browse files
committed
Small cleanups in the tree crafting.
- Use imports of c.universe._ rather than fully qualifying - Use attributed idents to refer to standard library symbols - Refactor duplicated code for default values
1 parent 82fcfdd commit 14ca71d

File tree

2 files changed

+135
-136
lines changed

2 files changed

+135
-136
lines changed

src/main/scala/scala/async/Async.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,14 @@ object Async extends AsyncUtils {
7474
}
7575
}
7676
*/
77+
val nonFatalModule = c.mirror.staticModule("scala.util.control.NonFatal")
7778
val resumeFunTree: c.Tree = DefDef(Modifiers(), newTermName("resume"), List(), List(List()), Ident(definitions.UnitClass),
7879
Try(Apply(Select(
7980
Apply(Select(handlerExpr.tree, newTermName("orElse")), List(handlerForLastState.tree)),
8081
newTermName("apply")), List(Ident(newTermName("state")))),
8182
List(
8283
CaseDef(
83-
Apply(Select(Select(Select(Ident(newTermName("scala")), newTermName("util")), newTermName("control")), newTermName("NonFatal")), List(Bind(newTermName("t"), Ident(nme.WILDCARD)))),
84+
Apply(Ident(nonFatalModule), List(Bind(newTermName("t"), Ident(nme.WILDCARD)))),
8485
EmptyTree,
8586
Block(List(
8687
Apply(Select(Ident(newTermName("result")), newTermName("failure")), List(Ident(newTermName("t"))))),

0 commit comments

Comments
 (0)