Expr
extends ObjectSupertypes
ObjectMembers
Unit
: implicit QuoteContext => Expr[Unit]Returns a unit expresssion equivalent to '{}
or '{()}
Returns a unit expresssion equivalent to '{}
or '{()}
null
: implicit QuoteContext => Expr[Null]Returns a null expresssion equivalent to '{null}
Returns a null expresssion equivalent to '{null}
unapply
[TypeBindings, Tup] ( scrutineeExpr: Expr[Any] ) ( implicit patternExpr: Expr[Any] , hasTypeSplices: Boolean , qctx: QuoteContext ) : Option[Tup]Pattern matches an the scrutineeExpr against the patternExpr and returns a tuple with the matched holes if successful.
Examples:
- Matcher.unapply('{ f(0...
[T]
Pattern matches an the scrutineeExpr against the patternExpr and returns a tuple with the matched holes if successful.
Examples:
- Matcher.unapply('{ f(0, myInt) })('{ f(0, myInt) }, _)
will return Some(())
(where ()
is a tuple of arity 0)
- Matcher.unapply('{ f(0, myInt) })('{ f(patternHole[Int], patternHole[Int]) }, _)
will return Some(Tuple2('{0}, '{ myInt }))
- Matcher.unapply('{ f(0, "abc") })('{ f(0, patternHole[Int]) }, _)
will return None
due to the missmatch of types in the hole
Holes:
- scala.internal.Quoted.patternHole[T]: hole that matches an expression x
of type Expr[U]
if U <:< T
and returns x
as part of the match.