Macros

scalus.macros.Macros
object Macros

Attributes

Graph
Supertypes
class Object
trait Matchable
class 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 fieldAsDataMacroTerm(using q: Quotes)(e: q.reflect.Term): Expr[Data => Data]
def fieldAsExprDataMacro[A : Type](e: Expr[A => Any])(implicit evidence$1: Type[A], Quotes): Expr[(Expr[Data]) => Expr[Data]]
def inlineBuiltinCostModelJsonImpl(using Quotes)(name: Expr[String]): Expr[String]
def lamMacro[A : Type, B : Type](f: Expr[(Expr[A]) => Expr[B]])(implicit evidence$1: Type[A], evidence$2: Type[B], Quotes): Expr[Expr[A => B]]
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

def mkReadWriterImpl[A : Type](implicit evidence$1: Type[A], Quotes): Expr[ReadWriter[A]]
def questionMark(using Quotes)(x: Expr[Boolean]): Expr[Boolean]