diff options
author | phaller <hallerp@gmail.com> | 2012-11-26 12:18:36 +0100 |
---|---|---|
committer | phaller <hallerp@gmail.com> | 2012-11-26 12:18:36 +0100 |
commit | 957fd86a0c8814c294af4f072d51d3cdd3fb4f49 (patch) | |
tree | 42eb98150cd2fac0193a66e6cbd31d49863cd8f3 /src/main | |
parent | 8812536cf13c59df31018b9e2fc4827dcf59bef6 (diff) | |
download | scala-async-957fd86a0c8814c294af4f072d51d3cdd3fb4f49.tar.gz scala-async-957fd86a0c8814c294af4f072d51d3cdd3fb4f49.tar.bz2 scala-async-957fd86a0c8814c294af4f072d51d3cdd3fb4f49.zip |
Turn object into def
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/scala/scala/async/TransformUtils.scala | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/main/scala/scala/async/TransformUtils.scala b/src/main/scala/scala/async/TransformUtils.scala index afa52b8..c5bbba1 100644 --- a/src/main/scala/scala/async/TransformUtils.scala +++ b/src/main/scala/scala/async/TransformUtils.scala @@ -168,18 +168,17 @@ private[async] final case class TransformUtils[C <: Context](c: C) { }.headOption.getOrElse(sys.error(s"Unable to find a method symbol in ${apply.tree}")) } - /** Using [[scala.reflect.api.Trees.TreeCopier]] copies more than we would like: - * we don't want to copy types and symbols to the new trees in some cases. - * - * Instead, we just copy positions and attachments. - */ - object attachCopy { - def apply[T <: Tree](orig: Tree)(tree: T): tree.type = { - tree.setPos(orig.pos) - for (att <- orig.attachments.all) - tree.updateAttachment[Any](att)(ClassTag.apply[Any](att.getClass)) - tree - } + /** + * Using [[scala.reflect.api.Trees.TreeCopier]] copies more than we would like: + * we don't want to copy types and symbols to the new trees in some cases. + * + * Instead, we just copy positions and attachments. + */ + def attachCopy[T <: Tree](orig: Tree)(tree: T): tree.type = { + tree.setPos(orig.pos) + for (att <- orig.attachments.all) + tree.updateAttachment[Any](att)(ClassTag.apply[Any](att.getClass)) + tree } } |