SymbolModule

Methods of the module object val Symbol

class Object
trait Matchable
class Any

Value members

Abstract methods

def classSymbol(fullName: String): Symbol

The class Symbol of a global class definition

def newBind(parent: Symbol, name: String, flags: Flags, tpe: TypeRepr): Symbol

Generates a pattern bind symbol with the given parent, name and type.

This symbol starts without an accompanying definition. It is the meta-programmer's responsibility to provide exactly one corresponding definition by passing this symbol to the BindDef constructor.

Value Params
flags

extra flags to with which the symbol should be constructed

Note

As a macro can only splice code into the point at which it is expanded, all generated symbols must be direct or indirect children of the reflection context's owner.

def newMethod(parent: Symbol, name: String, tpe: TypeRepr): Symbol

Generates a new method symbol with the given parent, name and type.

This symbol starts without an accompanying definition. It is the meta-programmer's responsibility to provide exactly one corresponding definition by passing this symbol to the DefDef constructor.

Note

As a macro can only splice code into the point at which it is expanded, all generated symbols must be direct or indirect children of the reflection context's owner.

def newMethod(parent: Symbol, name: String, tpe: TypeRepr, flags: Flags, privateWithin: Symbol): Symbol

Works as the other newMethod, but with additional parameters.

Value Params
flags

extra flags to with which the symbol should be constructed

privateWithin

the symbol within which this new method symbol should be private. May be noSymbol.

def newVal(parent: Symbol, name: String, tpe: TypeRepr, flags: Flags, privateWithin: Symbol): Symbol

Generates a new val/var/lazy val symbol with the given parent, name and type.

This symbol starts without an accompanying definition. It is the meta-programmer's responsibility to provide exactly one corresponding definition by passing this symbol to the ValDef constructor.

Note: Also see reflect.let

Value Params
flags

extra flags to with which the symbol should be constructed

privateWithin

the symbol within which this new method symbol should be private. May be noSymbol.

Note

As a macro can only splice code into the point at which it is expanded, all generated symbols must be direct or indirect children of the reflection context's owner.

Definition not available

Get class symbol if class is either defined in current compilation run or present on classpath.

Get method symbol if method is either defined in current compilation run or present on classpath. Throws if the method has an overload.

Get module symbol if module is either defined in current compilation run or present on classpath.

Get package symbol if package is either defined in current compilation run or present on classpath.

Symbol of the definition that encloses the current splicing context.

For example, the following call to spliceOwner would return the symbol x. val x = ${ ... Symbol.spliceOwner ... }

For a macro splice, it is the symbol of the definition where the macro expansion happens.