A factory which can create a package def from a prototype and a list of declarations.
Adds a list of top-level definitions to the compiler's symbol table.
Adds a list of top-level definitions to the compiler's symbol table. _TOP_LEVEL Allowed definitions include classes (represented by ClassDef
trees), traits (represented
by ClassDef
trees having the TRAIT
flag set in mods
) and objects (represented by ModuleDef
trees).
The definitions are put into the package with a prototype provided in packagePrototype
.
Supported prototypes are (see PackageSpec for more details):
* Strings and names representing a fully-qualified name of the package
* Trees that can work as package ids
* Package or package class symbols
Typical value for a package prototype is a fully-qualified name in a string.
For example, to generate a class available at foo.bar.Test
, call this method as follows:
introduceTopLevel("foo.bar", ClassDef(<mods>, TypeName("Test"), <tparams>, <template>))
It is possible to add definitions to the empty package by using nme.EMPTY_PACKAGE_NAME.toString
, but
that's not recommended, since such definitions cannot be seen from outside the empty package.
Only the multi-parameter overload of this method can be used to introduce companions.
If companions are introduced by two different calls, then they will be put into different virtual files, and scalac
will show an error about companions being defined in different files. By the way, this also means that there's currently no way
to define a companion for an existing class or module_TOP_LEVEL.
Returns a list of fully-qualified references to the introduced definitions.
Adds a top-level definition to the compiler's symbol table.
Adds a top-level definition to the compiler's symbol table. _TOP_LEVEL Allowed definitions include classes (represented by ClassDef
trees), traits (represented
by ClassDef
trees having the TRAIT
flag set in mods
) and objects (represented by ModuleDef
trees).
The definitions are put into the package with a prototype provided in packagePrototype
.
Supported prototypes are (see PackageSpec for more details):
* Strings and names representing a fully-qualified name of the package
* Trees that can work as package ids
* Package or package class symbols
Typical value for a package prototype is a fully-qualified name in a string.
For example, to generate a class available at foo.bar.Test
, call this method as follows:
introduceTopLevel("foo.bar", ClassDef(<mods>, TypeName("Test"), <tparams>, <template>))
It is possible to add definitions to the empty package by using nme.EMPTY_PACKAGE_NAME.toString
, but
that's not recommended, since such definitions cannot be seen from outside the empty package.
Only the multi-parameter overload of this method can be used to introduce companions.
If companions are introduced by two different calls, then they will be put into different virtual files, and scalac
will show an error about companions being defined in different files. By the way, this also means that there's currently no way
to define a companion for an existing class or module_TOP_LEVEL.
Returns a fully-qualified reference to the introduced definition.
Looks up a top-level definition tree with a given fully-qualified name (term name for modules, type name for classes).
Looks up a top-level definition tree with a given fully-qualified name
(term name for modules, type name for classes). _TREE Top-level tree is a tree that represents a non-inner class or object in one of the currently compiled source files.
Note that top-level isn't equivalent to scala.reflect.api.Symbols#SymbolApi.isStatic,
because static also embraces definitions nested in static objects
_TREE.
If such a tree does not exist, returns EmptyTree
.
Returns a reference to a top-level definition tree with a given fully-qualified name (term name for modules, type name for classes).
Returns a reference to a top-level definition tree with a given fully-qualified name
(term name for modules, type name for classes). _TREE Top-level tree is a tree that represents a non-inner class or object in one of the currently compiled source files.
Note that top-level isn't equivalent to scala.reflect.api.Symbols#SymbolApi.isStatic,
because static also embraces definitions nested in static objects
_TREE.
If such a tree does not exist, returns EmptyTree
.
Hosts supported package specs.
Returns string formatted according to given format
string.
Returns string formatted according to given format
string.
Format strings are as for String.format
(@see java.lang.String.format).
EXPERIMENTAL
A slice of the Scala macros context that exposes functions to introduce synthetic definitions.