Cleanup InputConvert

This commit is contained in:
Dale Wijnand 2018-01-27 09:40:42 +00:00
parent 90cd60f3b9
commit 77abb9ee29
No known key found for this signature in database
GPG Key ID: 4F256E3D151DF5EF
1 changed files with 7 additions and 8 deletions

View File

@ -8,11 +8,11 @@
package sbt package sbt
package std package std
import reflect.macros._ import scala.reflect.macros._
import Def.Initialize
import sbt.internal.util.complete.Parser import sbt.internal.util.complete.Parser
import sbt.internal.util.appmacro.{ Convert, Converted } import sbt.internal.util.appmacro.{ Convert, Converted }
import Def.Initialize
object InputInitConvert extends Convert { object InputInitConvert extends Convert {
def apply[T: c.WeakTypeTag](c: blackbox.Context)(nme: String, in: c.Tree): Converted[c.type] = def apply[T: c.WeakTypeTag](c: blackbox.Context)(nme: String, in: c.Tree): Converted[c.type] =
@ -46,14 +46,13 @@ object TaskConvert extends Convert {
/** Converts an input `Tree` of type `Initialize[T]`, `Initialize[Task[T]]`, or `Task[T]` into a `Tree` of type `Initialize[Task[T]]`.*/ /** Converts an input `Tree` of type `Initialize[T]`, `Initialize[Task[T]]`, or `Task[T]` into a `Tree` of type `Initialize[Task[T]]`.*/
object FullConvert extends Convert { object FullConvert extends Convert {
import InputWrapper._
def apply[T: c.WeakTypeTag](c: blackbox.Context)(nme: String, in: c.Tree): Converted[c.type] = def apply[T: c.WeakTypeTag](c: blackbox.Context)(nme: String, in: c.Tree): Converted[c.type] =
nme match { nme match {
case WrapInitTaskName => Converted.Success[c.type](in) case InputWrapper.WrapInitTaskName => Converted.Success[c.type](in)
case WrapPreviousName => Converted.Success[c.type](in) case InputWrapper.WrapPreviousName => Converted.Success[c.type](in)
case WrapInitName => wrapInit[T](c)(in) case InputWrapper.WrapInitName => wrapInit[T](c)(in)
case WrapTaskName => wrapTask[T](c)(in) case InputWrapper.WrapTaskName => wrapTask[T](c)(in)
case _ => Converted.NotApplicable[c.type] case _ => Converted.NotApplicable[c.type]
} }
private def wrapInit[T: c.WeakTypeTag](c: blackbox.Context)(tree: c.Tree): Converted[c.type] = { private def wrapInit[T: c.WeakTypeTag](c: blackbox.Context)(tree: c.Tree): Converted[c.type] = {