|
Scala example source code file (ExprUtils.scala)
The ExprUtils.scala Scala example source codepackage scala.reflect.macros package contexts trait ExprUtils { self: Context => import universe._ def literalNull = Expr[Null](Literal(Constant(null)))(TypeTag.Null) def literalUnit = Expr[Unit](Literal(Constant(())))(TypeTag.Unit) def literalTrue = Expr[Boolean](Literal(Constant(true)))(TypeTag.Boolean) def literalFalse = Expr[Boolean](Literal(Constant(false)))(TypeTag.Boolean) def literal(x: Boolean) = Expr[Boolean](Literal(Constant(x)))(TypeTag.Boolean) def literal(x: Byte) = Expr[Byte](Literal(Constant(x)))(TypeTag.Byte) def literal(x: Short) = Expr[Short](Literal(Constant(x)))(TypeTag.Short) def literal(x: Int) = Expr[Int](Literal(Constant(x)))(TypeTag.Int) def literal(x: Long) = Expr[Long](Literal(Constant(x)))(TypeTag.Long) def literal(x: Float) = Expr[Float](Literal(Constant(x)))(TypeTag.Float) def literal(x: Double) = Expr[Double](Literal(Constant(x)))(TypeTag.Double) def literal(x: String) = Expr[String](Literal(Constant(x)))(TypeTag[String](definitions.StringClass.toTypeConstructor)) def literal(x: Char) = Expr[Char](Literal(Constant(x)))(TypeTag.Char) } Other Scala source code examplesHere is a short list of links related to this Scala ExprUtils.scala source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.