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.
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.
Creates a Function tree using functionSym
as the Symbol and changing initialOwner
to functionSym
in body
.
>: Nothing <: Any
Returns a Type representing the type constructor tcp.
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]
.
Constructs a ValDef with a parameter modifier, a unique name, with the provided Type and with an empty rhs.
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.fresh, which increments
Constructs a new, synthetic, local ValDef Type tpe
, a unique name,
Position pos
, an empty implementation (no rhs), and owned by owner
.
Creates a new anonymous function symbol with Position pos
.
The type representing the type constructor [X] X
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
.
Modifiers for a local val.
Constructs a ValDef with local modifiers and a unique name.
Returns the symbol for the non-private method named name
for the class/module obj
.
Constructs a tuple value of the right TupleN type from the provided inputs.
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.
Creates a new, synthetic type variable with the specified owner
.
Create a Tree that references the val
represented by vd
, copying attributes from replaced
.
A Type that references the given type variable.
Returns the Symbol that references the statically accessible singleton i
.
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>)
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. UseContextUtil[c.type](c)
to construct.