Skip to content

Commit 51a8d69

Browse files
committed
Mark remaining tasks as TODO
1 parent 582971b commit 51a8d69

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

airframe-di/src/main/scala-3/wvlet/airframe/package.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ package object airframe {
3737
def newSilentDesign: Design = newDesign.noLifeCycleLogging
3838

3939
import scala.jdk.CollectionConverters._
40+
4041
// This will not be used in Scala 3, but left for the compatibility with Scala 2
4142
val traitFactoryCache = new ConcurrentHashMap[Surface, Session => Any].asScala
4243
def getOrElseUpdateTraitFactoryCache(s: Surface, factory: Session => Any): Session => Any = {

airframe-http-router/src/main/scala-3/wvlet/airframe/http/router/RouterBase.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ package wvlet.airframe.http.router
1616
import wvlet.airframe.http.Router
1717
import wvlet.airframe.http.HttpFilterType
1818
import wvlet.airframe.surface.Surface
19+
import wvlet.airframe.Session
1920

2021
trait RouterBase { self: Router =>
2122
inline def add[Controller]: Router = {
23+
// TODO registerTraitFactory
2224
self.addInternal(Surface.of[Controller], Surface.methodsOf[Controller])
2325
}
2426

@@ -41,9 +43,22 @@ private[router] object RouterObjectMacros {
4143
import quotes.reflect._
4244

4345
if (TypeRepr.of[Controller] <:< TypeRepr.of[HttpFilterType]) {
46+
// TODO registerTraitFactory
4447
'{ Router(filterSurface = Some(Surface.of[Controller])) }
4548
} else {
49+
// TODO registerTraitFactory
4650
'{ Router.empty.add[Controller] }
4751
}
4852
}
53+
54+
// def registerTraitFactory[T: Type](using quotes: Quotes): Expr[Unit] = {
55+
// // TODO implement simlar thing method like AirframeMacros.shouldGenerateTrait
56+
// // TODO instantiate an arbitrary trait https://github.com/lampepfl/dotty/issues/11685
57+
// val t = Type.of[T].info
58+
// '{ wvlet.airframe.getOrElseUpdateTraitFactoryCache(
59+
// Surface.of[T],
60+
// { (ss: Session) => (new ${t} {}).asInstanceOf[Any] }
61+
// )
62+
// }
63+
// }
4964
}

0 commit comments

Comments
 (0)