Packages

final class ContextUtil[C <: Context] extends AnyRef

Utility methods for macros. Several methods assume that the context's universe is a full compiler (scala.tools.nsc.Global). This is not thread safe due to the underlying Context and related data structures not being thread safe. Use ContextUtil[c.type](c) to construct.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ContextUtil
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ContextUtil(ctx: C)

Type Members

  1. type PropertyChecker = (String, scala.reflect.macros.Universe.Type, scala.reflect.macros.Universe.Tree) ⇒ Boolean

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. lazy val alist: scala.reflect.macros.Universe.Symbol
  5. lazy val alistTC: scala.reflect.macros.Universe.Type
  6. lazy val alistType: C.Type
  7. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  8. def callsiteTyper: (analyzer)#Typer
  9. def changeOwner(tree: scala.reflect.macros.Universe.Tree, prev: scala.reflect.macros.Universe.Symbol, next: scala.reflect.macros.Universe.Symbol): Unit
  10. def checkReferences(defs: Set[scala.reflect.macros.Universe.Symbol], isWrapper: PropertyChecker, mType: scala.reflect.macros.Universe.Type): (scala.reflect.macros.Universe.Tree) ⇒ Unit

    A function that checks the provided tree for illegal references to M instances defined in the expression passed to the macro and for illegal dereferencing of M instances.

  11. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  12. def collectDefs(tree: scala.reflect.macros.Universe.Tree, isWrapper: (String, scala.reflect.macros.Universe.Type, scala.reflect.macros.Universe.Tree) ⇒ Boolean): Set[scala.reflect.macros.Universe.Symbol]

    Collects all definitions in the tree for use in checkReferences.

    Collects all definitions in the tree for use in checkReferences. This excludes definitions in wrapped expressions because checkReferences won't allow nested dereferencing anyway.

  13. def createFunction(params: List[scala.reflect.macros.Universe.ValDef], body: scala.reflect.macros.Universe.Tree, functionSym: scala.reflect.macros.Universe.Symbol): scala.reflect.macros.Universe.Tree

    Creates a Function tree using functionSym as the Symbol and changing initialOwner to functionSym in body.

  14. val ctx: C
  15. def emptyTypeBounds: scala.reflect.macros.Universe.TypeBounds

    >: Nothing <: Any

  16. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  18. def extractTC(tcp: Singleton, name: String)(implicit it: C.TypeTag[tcp]): C.Type

    Returns a Type representing the type constructor tcp.<name>.

    Returns a Type representing the type constructor tcp.<name>. For example, given object Demo { type M[x] = List[x] }, the call extractTC(Demo, "M") will return a type representing the type constructor [x] List[x].

  19. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  20. def freshMethodParameter(tpe: scala.reflect.macros.Universe.Type): scala.reflect.macros.Universe.ValDef

    Constructs a ValDef with a parameter modifier, a unique name, with the provided Type and with an empty rhs.

  21. def freshTermName(prefix: String): scala.reflect.macros.Universe.TermName

    Constructs a unique term name with the given prefix within this Context.

    Constructs a unique term name with the given prefix within this Context. (The current implementation uses Context.freshName, which increments

  22. def freshValDef(tpe: scala.reflect.macros.Universe.Type, pos: scala.reflect.macros.Universe.Position, owner: scala.reflect.macros.Universe.Symbol): scala.reflect.macros.Universe.ValDef

    Constructs a new, synthetic, local ValDef Type tpe, a unique name, Position pos, an empty implementation (no rhs), and owned by owner.

  23. def functionSymbol(pos: scala.reflect.macros.Universe.Position): scala.reflect.macros.Universe.Symbol

    Creates a new anonymous function symbol with Position pos.

  24. def functionType(args: List[scala.reflect.macros.Universe.Type], result: scala.reflect.macros.Universe.Type): scala.reflect.macros.Universe.Type
  25. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  26. def getPos(sym: scala.reflect.macros.Universe.Symbol): scala.reflect.macros.Universe.Position
  27. val global: universe.type
  28. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  29. lazy val idTC: scala.reflect.macros.Universe.Type

    The type representing the type constructor [X] X

  30. def illegalReference(defs: Set[scala.reflect.macros.Universe.Symbol], sym: scala.reflect.macros.Universe.Symbol): Boolean

    A reference is illegal if it is to an M instance defined within the scope of the macro call.

    A reference is illegal if it is to an M instance defined within the scope of the macro call. As an approximation, disallow referenced to any local definitions defs.

  31. def illegalReference(defs: Set[scala.reflect.macros.Universe.Symbol], sym: scala.reflect.macros.Universe.Symbol, mType: scala.reflect.macros.Universe.Type): Boolean

    A reference is illegal if it is to an M instance defined within the scope of the macro call.

    A reference is illegal if it is to an M instance defined within the scope of the macro call. As an approximation, disallow referenced to any local definitions defs.

  32. val initialOwner: scala.reflect.macros.Universe.Symbol
  33. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  34. lazy val localModifiers: scala.reflect.macros.Universe.Modifiers

    Modifiers for a local val.

  35. def localValDef(tpt: scala.reflect.macros.Universe.Tree, rhs: scala.reflect.macros.Universe.Tree): scala.reflect.macros.Universe.ValDef

    Constructs a ValDef with local modifiers and a unique name.

  36. def method(obj: scala.reflect.macros.Universe.Symbol, name: String): scala.reflect.macros.Universe.Symbol

    Returns the symbol for the non-private method named name for the class/module obj.

  37. def mkTuple(args: List[scala.reflect.macros.Universe.Tree]): scala.reflect.macros.Universe.Tree

    Constructs a tuple value of the right TupleN type from the provided inputs.

  38. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  39. def newTCVariable(owner: scala.reflect.macros.Universe.Symbol): scala.reflect.macros.Universe.TypeSymbol

    Constructs a new, synthetic type variable that is a type constructor.

    Constructs a new, synthetic type variable that is a type constructor. For example, in type Y[L[x]], L is such a type variable.

  40. def newTypeVariable(owner: scala.reflect.macros.Universe.Symbol, prefix: String = "T0"): scala.reflect.macros.Universe.TypeSymbol

    Creates a new, synthetic type variable with the specified owner.

  41. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  42. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  43. lazy val parameterModifiers: scala.reflect.macros.Universe.Modifiers
  44. val powerContext: Context
  45. def refVal(replaced: scala.reflect.macros.Universe.Tree, vd: scala.reflect.macros.Universe.ValDef): scala.reflect.macros.Universe.Tree

    Create a Tree that references the val represented by vd, copying attributes from replaced.

  46. def refVar(variable: scala.reflect.macros.Universe.TypeSymbol): scala.reflect.macros.Universe.Type

    A Type that references the given type variable.

  47. def select(t: scala.reflect.macros.Universe.Tree, name: String): scala.reflect.macros.Universe.Tree
  48. def setInfo(sym: scala.reflect.macros.Universe.Symbol, tpe: scala.reflect.macros.Universe.Type): Unit
  49. def setSymbol[_Tree](t: _Tree, sym: scala.reflect.macros.Universe.Symbol): Unit
  50. def singleton[T <: Singleton](i: T)(implicit it: C.TypeTag[i.type]): scala.reflect.macros.Universe.Symbol

    Returns the Symbol that references the statically accessible singleton i.

  51. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  52. def toString(): String
    Definition Classes
    AnyRef → Any
  53. def transformWrappers(t: scala.reflect.macros.Universe.Tree, subWrapper: (String, scala.reflect.macros.Universe.Type, scala.reflect.macros.Universe.Tree, scala.reflect.macros.Universe.Tree) ⇒ Converted[ctx.type]): scala.reflect.macros.Universe.Tree

    Substitutes wrappers in tree t with the result of subWrapper.

    Substitutes wrappers in tree t with the result of subWrapper. A wrapper is a Tree of the form f[T](v) for which isWrapper(<Tree of f>, <Underlying Type>, <qual>.target) returns true. Typically, f is a Select or Ident. The wrapper is replaced with the result of subWrapper(<Type of T>, <Tree of v>, <wrapper Tree>)

  54. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  55. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  56. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Deprecated Value Members

  1. def checkReferences(defs: Set[scala.reflect.macros.Universe.Symbol], isWrapper: PropertyChecker): (scala.reflect.macros.Universe.Tree) ⇒ Unit
    Annotations
    @deprecated
    Deprecated

    (Since version 1.3.0) Use that variant that specifies the M instance types to exclude

Inherited from AnyRef

Inherited from Any

Ungrouped