Macros
scalus.macros.Macros
object Macros
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Macros.type
Members list
Value members
Concrete methods
def fieldAsDataMacro[A : Type](e: Expr[A => Any])(implicit evidence$1: Type[A], Quotes): Expr[Data => Data]
def fieldAsExprDataMacro[A : Type](e: Expr[A => Any])(implicit evidence$1: Type[A], Quotes): Expr[(Expr[Data]) => Expr[Data]]
def mkClassFieldsFromSeqIsoImpl[A : Type](implicit evidence$1: Type[A], Quotes): Expr[(A => Seq[Long], (Seq[Long]) => A)]
Generates a pair of functions to convert a class to a sequence of longs and vice versa. The generated code is equivalent to the following:
Generates a pair of functions to convert a class to a sequence of longs and vice versa. The generated code is equivalent to the following:
(
(m: A) => Seq(m.field1, m.field2, ...),
(seq: Seq[Long]) => {
val params = new A()
params.field1 = if idx < seq.size then seq(0) else 0L
...
params
}
)
Type parameters
- A
-
the type of the class
Attributes
- Returns
-
a pair of functions
def mkGetBuiltinRuntime(bm: Expr[BuiltinsMeaning])(using Quotes): Expr[DefaultFun => BuiltinRuntime]
Generates match
expression on DefaultFun ordinals that should be efficiently compiled to table switch (and it is).
Generates match
expression on DefaultFun ordinals that should be efficiently compiled to table switch (and it is).
fun.ordinal() match {
case 0 => bm.AddInteger
// ...
}
Attributes
In this article