Macros

cask.router.Macros$
object Macros

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Macros.type

Members list

Concise view

Value members

Concrete methods

def call(using Quotes)(method: Symbol, argss: Expr[Seq[Seq[Any]]]): Expr[_]

Call a method given by its symbol.

Call a method given by its symbol.

E.g.

assuming:

def foo(x: Int, y: String)(z: Int)

val argss: List[List[Any]] = ???

then:

call(, '{argss})

will expand to:

foo(argss(0)(0), argss(0)(1))(argss(1)(0))

Attributes

def checkDecorators(using Quotes)(decorators: List[Expr[Decorator[_, _, _]]]): Boolean

Check that decorator inner and outer return types match.

Check that decorator inner and outer return types match.

This replicates EndpointMetadata.seqify, but in a macro where error positions can be controlled.

Attributes

def convertToResponse(using Quotes)(method: Symbol, endpoint: Expr[Endpoint[_, _, _]], result: Expr[Any]): Expr[Any]

Convert a result to an HTTP response

Convert a result to an HTTP response

Note: essentially, all this method does is summon a cask.internal.Conversion and provide a helpful error message if it cannot be found. In this case, one could wonder why we do the implicit summoning in this macro, rather than emit "regular" code which does the summoning. The reason is to provide helpful error messages with correct positions. We can control the position in the macro, but if the error were to come from the expanded code the position would be completely off.

Attributes

def extractMethod[Cls : Type](using q: Quotes)(method: Symbol, decorators: List[Expr[Decorator[_, _, _]]], endpoint: Expr[Endpoint[_, _, _]]): Expr[EntryPoint[Cls, Request]]
def friendlyName(using Quotes)(param: ValDef): String

The type of paramters displayed in error messages

The type of paramters displayed in error messages

Attributes

def getDefaultParams(using Quotes)(method: Symbol): Map[Symbol, Expr[Any]]

Lookup default values for a method's parameters.

Lookup default values for a method's parameters.

Attributes

def summonReader(using Quotes)(decorator: Expr[Decorator[_, _, _]], param: Symbol): Expr[ArgReader[_, _, _]]

Summon the reader for a parameter.

Summon the reader for a parameter.

Attributes