summaryrefslogtreecommitdiff
path: root/core/src/main/scala/forge/discover/Router.scala
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2017-11-10 04:15:47 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2017-11-10 04:15:47 -0800
commitb0e32c659e334b334e3f1e1a835328b32f20e759 (patch)
tree13ede60ba347041786776c7d0c2f14364c76b912 /core/src/main/scala/forge/discover/Router.scala
parent550772d7515757339269c28c41fd0d8109e0fa2c (diff)
downloadmill-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/src/main/scala/forge/discover/Router.scala')
-rw-r--r--core/src/main/scala/forge/discover/Router.scala3
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)
}