use quote

This commit is contained in:
jilen 2024-12-12 15:38:00 +08:00
parent 475896f27e
commit 87e0213b06

View file

@ -23,17 +23,6 @@ extension [E](inline e: EntityQuery[E]) {
} }
} }
extension [A, B](inline f1: A => B) {
private inline def param0 = parsing.parseParamAt(f1, 0)
private inline def body = parsing.parseBody(f1)
}
extension [A1, A2, B](inline f1: (A1, A2) => B) {
private inline def param0 = parsing.parseParamAt(f1, 0)
private inline def param1 = parsing.parseParamAt(f1, 1)
private inline def body = parsing.parseBody(f1)
}
private inline def transform[D1 <: Quoted, D2 <: Quoted, A, B](inline ast: Ast)( private inline def transform[D1 <: Quoted, D2 <: Quoted, A, B](inline ast: Ast)(
inline f: A => B inline f: A => B
)(inline fast: (Ast, Ident, Ast) => Ast)(inline f2: Ast => D2): D2 = { )(inline fast: (Ast, Ident, Ast) => Ast)(inline f2: Ast => D2): D2 = {
@ -79,6 +68,13 @@ private def compileImpl(x: Expr[Quoted])(using Quotes): Expr[Option[String]] = {
} }
} }
case class Foo(id: Long) extension [A, B](inline f1: A => B) {
private inline def param0 = parsing.parseParamAt(f1, 0)
private inline def body = parsing.parseBody(f1)
}
inline def queryFooId = query[Foo]("foo").map(_.id) extension [A1, A2, B](inline f1: (A1, A2) => B) {
private inline def param0 = parsing.parseParamAt(f1, 0)
private inline def param1 = parsing.parseParamAt(f1, 1)
private inline def body = parsing.parseBody(f1)
}