diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2017-11-10 04:15:47 -0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2017-11-10 04:15:47 -0800 |
commit | b0e32c659e334b334e3f1e1a835328b32f20e759 (patch) | |
tree | 13ede60ba347041786776c7d0c2f14364c76b912 /core | |
parent | 550772d7515757339269c28c41fd0d8109e0fa2c (diff) | |
download | mill-b0e32c659e334b334e3f1e1a835328b32f20e759.tar.gz mill-b0e32c659e334b334e3f1e1a835328b32f20e759.tar.bz2 mill-b0e32c659e334b334e3f1e1a835328b32f20e759.zip |
Kill `Router.main` annotation and make routing dependent on the `Command` return type
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/scala/forge/discover/Router.scala | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/core/src/main/scala/forge/discover/Router.scala b/core/src/main/scala/forge/discover/Router.scala index 2c92d847..1034b46e 100644 --- a/core/src/main/scala/forge/discover/Router.scala +++ b/core/src/main/scala/forge/discover/Router.scala @@ -16,7 +16,6 @@ import scala.language.experimental.macros */ object Router{ class doc(s: String) extends StaticAnnotation - class main extends StaticAnnotation def generateRoutes[T]: Seq[Router.EntryPoint[T]] = macro generateRoutesImpl[T] def generateRoutesImpl[T: c.WeakTypeTag](c: Context): c.Expr[Seq[EntryPoint[T]]] = { import c.universe._ @@ -385,7 +384,7 @@ class Router [C <: Context](val c: C) { def getAllRoutesForClass(curCls: Type): Iterable[c.universe.Tree] = { for{ t <- getValsOrMeths(curCls) - if t.annotations.exists(_.tpe =:= typeOf[Router.main]) + if t.returnType <:< typeOf[forge.define.Command[_]] } yield { extractMethod(t, curCls) } |