A tree printer which is stingier about vertical whitespace and unnecessary punctuation than the standard one.
One unit of compilation that has been submitted to the compiler.
Collects for certain classes of warnings during this run.
A context tree contains contexts that are indexed by positions.
Aux datastructure for solving the constraint system The depency graph container with helper methods for node and edge creation
Documented definition, eliminated by analyzer
Derived value class injection (equivalent to: new C(arg)
after erasure); only used during erasure.
A locator for trees with given positions.
Info given for every member found by completion
A do-nothing work scheduler that responds immediately with MissingResponse.
Only used during parsing
A Run is a single execution of the compiler on a sets of units
This must guarantee not to force any evaluation, so we can learn a little bit about trees in the midst of compilation without altering the natural course of events.
Array selection <qualifier> . <name>
only used during erasure
Generate ASTs
Generate ASTs
A transformer that replaces tree from
with tree to
in a given tree
emitted by typer, eliminated by refchecks
The typer run
(Since version 2.10.0) SI-6458: Instrumentation logic will be moved out of the compiler.
Construct class definition with given class symbol, value parameters, supercall arguments and template body.
Construct class definition with given class symbol, value parameters, supercall arguments and template body.
the class symbol
the modifiers for the class constructor, i.e. as in class C private (...)
the value parameters -- if they have symbols they
should be owned by sym
the supercall arguments
the template statements without primary constructor and value parameter fields.
The status value of a unit that has not yet been typechecked
The status value of a unit that has not yet been typechecked
An object representing a missing compilation unit.
The status value of a unit that has not yet been loaded
The status value of a unit that has not yet been loaded
The status value of a unit that has been partially typechecked
The status value of a unit that has been partially typechecked
Generates a template with constructor corresponding to
Generates a template with constructor corresponding to
constrmods (vparams1_) ... (vparams_n) preSuper { presupers } extends superclass(args_1) ... (args_n) with mixins { self => body }
This gets translated to
extends superclass with mixins { self => presupers' // presupers without rhs vparamss // abstract fields corresponding to value parameters def <init>(vparamss) { presupers super.<init>(args) } body }
Insert a context with non-transparent position cpos
at correct position into a buffer of context trees.
Insert a context with non-transparent position cpos
at correct position into a buffer of context trees.
Insert a context at correct position into a buffer of context trees.
Insert a context at correct position into a buffer of context trees.
If the context
has a transparent position, add it multiple times
at the positions of all its solid descendant trees.
Returns List of (phase, value) pairs, including only those where the value compares unequal to the previous phase's value.
Returns List of (phase, value) pairs, including only those where the value compares unequal to the previous phase's value.
A list giving all files to be typechecked in the order they should be checked.
A list giving all files to be typechecked in the order they should be checked.
ICode analysis for optimization
Asks for a computation to be done quickly on the presentation compiler thread
Asks for a computation to be done quickly on the presentation compiler thread
Sets sync var response
to doc comment information for a given symbol.
Sets sync var response
to doc comment information for a given symbol.
The symbol whose doc comment should be retrieved (might come from a classfile)
The source file that's supposed to contain the definition
The symbol where 'sym' is observed
All symbols that can contribute to the generated documentation together with their source files.
A response that will be set to the following:
If source
contains a definition of a given symbol that has a doc comment,
the (expanded, raw, position) triplet for a comment, otherwise ("", "", NoPosition).
Note: This operation does not automatically load sources that are not yet loaded.
Removes source files and toplevel symbols, and issues a new typer run.
Removes source files and toplevel symbols, and issues a new typer run.
Returns () to syncvar response
on completion.
Asks for a computation to be done on presentation compiler thread, returning a response with the result or an exception
Asks for a computation to be done on presentation compiler thread, returning a response with the result or an exception
Sets sync var response
to the position of the definition of the given link in
the given sourcefile.
Sets sync var response
to the position of the definition of the given link in
the given sourcefile.
The symbol referenced by the link (might come from a classfile)
The source file that's supposed to contain the definition
A response that will be set to the following:
If source
contains a definition that is referenced by the given link
the position of that definition, otherwise NoPosition.
Note: This operation does not automatically load source
. If source
is unloaded, it stays that way.
If source is not yet loaded, loads it, and starts a new run, otherwise continues with current pass.
If source is not yet loaded, loads it, and starts a new run, otherwise continues with current pass. Waits until source is fully type checked and returns body in response.
The source file that needs to be fully typed.
The response, which is set to the fully attributed tree of source
.
If the unit corresponding to source
has been removed in the meantime
the a NoSuchUnitError is raised in the response.
Set sync var response
to the parse tree of source
with all top-level symbols entered.
Set sync var response
to the parse tree of source
with all top-level symbols entered.
The source file to be analyzed
If set to true
, source file will be kept as a loaded unit afterwards.
If keepLoaded is false
the operation is run at low priority, only after
everything is brought up to date in a regular type checker run.
The response.
Makes sure a set of compilation units is loaded and parsed.
Makes sure a set of compilation units is loaded and parsed.
Returns () to syncvar response
on completion.
Afterwards a new background compiler run is started with
the given sources at the head of the list of to-be-compiled sources.
Cancels current compiler run and start a fresh one where everything will be re-typechecked (but not re-loaded).
Cancels current compiler run and start a fresh one where everything will be re-typechecked (but not re-loaded).
Sets sync var response
to list of members that are visible
as members of the scope enclosing pos
.
Sets sync var response
to list of members that are visible
as members of the scope enclosing pos
.
Tells the compile server to shutdown, and not to restart again
Tells the compile server to shutdown, and not to restart again
If source if not yet loaded, get an outline view with askParseEntered.
If source if not yet loaded, get an outline view with askParseEntered. If source is loaded, wait for it to be typechecked. In both cases, set response to parsed (and possibly typechecked) tree.
If set to true
, source file will be kept as a loaded unit afterwards.
Asks to do unit corresponding to given source file on present and subsequent type checking passes.
Asks to do unit corresponding to given source file on present and subsequent type checking passes. If the file is in the 'crashedFiles' ignore list it is removed and typechecked normally.
Sets sync var response
to the smallest fully attributed tree that encloses position pos
.
Sets sync var response
to the smallest fully attributed tree that encloses position pos
.
Note: Unlike for most other ask... operations, the source file belonging to pos
needs not be loaded.
Sets sync var response
to list of members that are visible
as members of the tree enclosing pos
, possibly reachable by an implicit.
Sets sync var response
to list of members that are visible
as members of the tree enclosing pos
, possibly reachable by an implicit.
Check that the currenyly executing thread is the presentation compiler thread.
Check that the currenyly executing thread is the presentation compiler thread.
Compiler initialization may happen on a different thread (signalled by globalPhase being NoPhase)
Position a tree.
Position a tree. This means: Set position of a node and position all its unpositioned children.
Returns List of ChangeAfterPhase objects, encapsulating those phase transitions where the result of the operation gave a different list than it had when run during the previous phase.
Returns List of ChangeAfterPhase objects, encapsulating those phase transitions where the result of the operation gave a different list than it had when run during the previous phase.
Flush the buffer of sources that are ignored during background compilation.
Add the internal compiler phases to the phases set.
Add the internal compiler phases to the phases set. This implementation creates a description map at the same time.
Extract all phases supplied by plugins and add them to the phasesSet.
Extract all phases supplied by plugins and add them to the phasesSet.
phasesSet
Fold constants
The raw doc comment of symbol sym
, minus usecase and define sections, augmented by
missing sections of an inherited doc comment.
The raw doc comment of symbol sym
, minus usecase and define sections, augmented by
missing sections of an inherited doc comment.
If a symbol does not have a doc comment but some overridden version of it does,
the doc comment of the overridden version is copied instead.
Copy propagation for optimization
The currently active run
The currently active run
The id of the currently active run
The id of the currently active run
Print msg only when debugIDE is true.
Print msg only when debugIDE is true.
The top level classes and objects no longer seen in the presentation compiler
Invalidate contents of setting -Yinvalidate
Invalidate contents of setting -Yinvalidate
Returns the smallest context that contains given pos
, throws FatalError if none exists.
Returns the smallest context that contains given pos
, throws FatalError if none exists.
Associate comment with symbol sym
at position pos
.
Associate comment with symbol sym
at position pos
.
The position of the raw doc comment of symbol sym
, or NoPosition if missing
If a symbol does not have a doc comment but some overridden version of it does,
the position of the doc comment of the overridden version is returned instead.
The position of the raw doc comment of symbol sym
, or NoPosition if missing
If a symbol does not have a doc comment but some overridden version of it does,
the position of the doc comment of the overridden version is returned instead.
The raw doc comment map
The raw doc comment map
Remove a crashed file from the ignore buffer.
Remove a crashed file from the ignore buffer. Background compilation will take it into account and errors will be reported against it.
Ensure that given tree has no positions that overlap with
any of the positions of others
.
Ensure that given tree has no positions that overlap with
any of the positions of others
. This is done by
shortening the range, assigning TransparentPositions
to some of the nodes in tree
or focusing on the position.
Expand inheritdoc tags
Expand inheritdoc tags
This is done separately, for two reasons: 1. It takes longer to run compared to merge 2. The inheritdoc annotation should not be used very often, as building the comment from pieces severely impacts performance
The source (or parent) comment
The child (overriding member or usecase) comment
The child symbol
The child comment with the inheritdoc sections expanded
Expand variable occurrences in string str
, until a fix point is reached or
a expandLimit is exceeded.
Expand variable occurrences in string str
, until a fix point is reached or
a expandLimit is exceeded.
The symbol for which doc comments are generated
The class for which doc comments are generated
Expanded string
Returns just the wiki expansion (this would correspond to a comment in the input format of the JavaDoc tool, modulo differences in tags.
Returns just the wiki expansion (this would correspond to a comment in the input format of the JavaDoc tool, modulo differences in tags.)
The cooked doc comment of symbol sym
after variable expansion, or "" if missing.
The cooked doc comment of symbol sym
after variable expansion, or "" if missing.
The symbol for which doc comment is returned (site is always the containing class)
The cooked doc comment of symbol sym
after variable expansion, or "" if missing.
The cooked doc comment of symbol sym
after variable expansion, or "" if missing.
The symbol for which doc comment is returned
The class for which doc comments are generated
when more than 10 successive expansions of the same string are done, which is interpreted as a recursive variable definition.
Does given list of trees have mutually non-overlapping positions? pre: None of the trees is transparent
Does given list of trees have mutually non-overlapping positions? pre: None of the trees is transparent
Tree generation, usually based on existing symbols.
Returns the file with the given suffix for the given class.
Returns the file with the given suffix for the given class. Used for icode writing.
The compilation unit corresponding to a source file if it does not yet exist create a new one atomically Note: We want to remove this.
The compilation unit corresponding to a source file if it does not yet exist create a new one atomically Note: We want to remove this.
A map that associates with each abstract file the set of responses that ware waiting (via build) for the unit associated with the abstract file to be parsed and entered
A map that associates with each abstract file the set of responses that ware waiting (via build) for the unit associated with the abstract file to be parsed and entered
Work through toBeRemoved list to remove any units.
Work through toBeRemoved list to remove any units. Then return optionally unit associated with given source.
Return the compilation unit attached to a source file, or None if source is not loaded.
Return the compilation unit attached to a source file, or None if source is not loaded.
Icode verification
ICode generator
Inform with msg only when verboseIDE is true.
Inform with msg only when verboseIDE is true.
Compute an instrumented version of a sourcefile.
Compute an instrumented version of a sourcefile.
The given sourcefile.
The line up to which results should be printed, -1 = whole document.
A pair consisting of
Invalidates packages that contain classes defined in a classpath entry, and rescans that entry.
Invalidates packages that contain classes defined in a classpath entry, and rescans that entry.
A pair consisting of
Let's share a lot more about why we crash all over the place.
Let's share a lot more about why we crash all over the place. People will be very grateful.
There are common error conditions where when the exception hits here, currentRun.
There are common error conditions where when the exception hits here, currentRun.currentUnit is null. This robs us of the knowledge of what file was being compiled when it broke. Since I really really want to know, this hack.
Load all available plugins.
Load all available plugins. Skips plugins that either have the same name as another one, or which define a phase name that another one does.
Load a rough list of the plugins.
Load a rough list of the plugins. For speed, it does not instantiate a compiler run. Therefore it cannot test for same-named phases or other problems that are filtered from the final list of plugins.
Symbol loaders in the IDE parse all source files loaded from a package for top-level idents.
Optionally returns the smallest context that contains given pos
, or None if none exists.
Optionally returns the smallest context that contains given pos
, or None if none exists.
Locates smallest context that encloses position as an optional value.
Locates smallest context that encloses position as an optional value.
Locate smallest tree that encloses position
Locate smallest tree that encloses position
Lookup definition of variable.
Lookup definition of variable.
The variable for which a definition is searched
The class for which doc comments are generated
Merge elements of doccomment src
into doc comment dst
for symbol sym
.
Merge elements of doccomment src
into doc comment dst
for symbol sym
.
In detail:
copyFirstPara
is true, copy first paragraph
2. For all parameters of sym
if there is no @param section
in dst
for that parameter name, but there is one on src
, copy that section.
3. If there is no @return section in dst
but there is one in src
, copy it.
Returns the mirror that loaded given symbol
Returns the mirror that loaded given symbol
Move list of files to front of allSources
Print tree in detailed form
Run operation op
on a compilation unit associated with given source
.
Run operation op
on a compilation unit associated with given source
.
If source has a loaded compilation unit, this one is passed to op
.
Otherwise a new compilation unit is created, but not added to the set of loaded units.
Computing pairs of overriding/overridden symbols
Returns parse tree for source source
.
Returns parse tree for source source
. No symbols are entered. Syntax errors are reported.
This method is thread-safe and as such can safely run outside of the presentation compiler thread.
A description of the phases that will run
A description of the phases that will run
Summary of the per-phase values of nextFlags and newFlags, shown with -Xshow-phases if -Ydebug also given.
Summary of the per-phase values of nextFlags and newFlags, shown with -Xshow-phases if -Ydebug also given.
The names of the phases.
The names of the phases.
A description of all the plugins that are loaded
A description of all the plugins that are loaded
Summary of the options for all loaded plugins
Summary of the options for all loaded plugins
Switch to turn on detailed type logs
Switch to turn on detailed type logs
The raw doc comment of symbol sym
, as it appears in the source text, "" if missing.
The raw doc comment of symbol sym
, as it appears in the source text, "" if missing.
Returns the top level classes and objects that were deleted in the editor since last time recentlyDeleted() was called.
Returns the top level classes and objects that were deleted in the editor since last time recentlyDeleted() was called.
Called from typechecker every time a context is created.
Called from typechecker every time a top-level class or object is entered.
Removes the CompilationUnit corresponding to the given SourceFile from consideration for recompilation.
Removes the CompilationUnit corresponding to the given SourceFile from consideration for recompilation.
resets symbol and tpe fields in a tree, @see ResetAttrs
resets symbol and tpe fields in a tree, @see ResetAttrs
Scala primitives, used in genicode
The scheduler by which client and compiler communicate Must be initialized before starting compilerRunner
The scheduler by which client and compiler communicate Must be initialized before starting compilerRunner
We resolve the class/object ambiguity by passing a type/term name.
We resolve the class/object ambiguity by passing a type/term name.
Called from typechecker, which signals hereby that a node has been completely typechecked.
Called from typechecker, which signals hereby that a node has been completely typechecked. If the node includes unit.targetPos, abandons run and returns newly attributed tree. Otherwise, if there's some higher priority work to be done, also abandons run with a FreshRunReq.
The context that typechecked the node
The original node
The transformed node
Called from parser, which signals hereby that a method definition has been parsed.
Some statistics (normally disabled) set with -Ystatistics
The cooked doc comment of an overridden symbol
The cooked doc comment of an overridden symbol
Don't want to introduce new errors trying to report errors, so swallow exceptions.
Don't want to introduce new errors trying to report errors, so swallow exceptions.
Update deleted and current top-level symbols sets
A set containing all those files that need to be removed Units are removed by getUnit, typically once a unit is finished compiled.
A set containing all those files that need to be removed Units are removed by getUnit, typically once a unit is finished compiled.
A set containing all those files that need to be removed after a full background compiler run
A set containing all those files that need to be removed after a full background compiler run
Returns the javadoc format of doc comment string s
, including wiki expansion
Returns the javadoc format of doc comment string s
, including wiki expansion
Representing ASTs as graphs
Trees fresh from the oven, mostly for use by the parser.
Tree checker
A map of all loaded files to the rich compilation units that correspond to them.
The list of use cases of doc comment of symbol sym
seen as a member of class
site
.
The list of use cases of doc comment of symbol sym
seen as a member of class
site
. Each use case consists of a synthetic symbol (which is entered nowhere else),
of an expanded doc comment string, and of its position.
The symbol for which use cases are returned
The class for which doc comments are generated
when more than 10 successive expansions of the same string are done, which is interpreted as a recursive variable definition.
A map that associates with each abstract file the set of responses that are waiting (via waitLoadedTyped) for the unit associated with the abstract file to be loaded and completely typechecked.
A map that associates with each abstract file the set of responses that are waiting (via waitLoadedTyped) for the unit associated with the abstract file to be loaded and completely typechecked.
A position that wraps a non-empty set of trees.
A position that wraps a non-empty set of trees. The point of the wrapping position is the point of the first trees' position. If some of the trees are ranges, returns a range position enclosing all ranges Otherwise returns first tree's position.
A position that wraps a set of trees.
A position that wraps a set of trees. The point of the wrapping position is the point of the default position. If some of the trees are ranges, returns a range position enclosing all ranges Otherwise returns default position that is either focused or not.
(global: StringAdd).self
(global: StringFormat).self
(Since version 2.10.0) Give us a reason
(Since version 2.10.2) Use method that accepts fragments
Set sync var response
to a pair consisting of
Set sync var response
to a pair consisting of
The source file to be analyzed
The response.
(Since version 2.10.0) SI-6458: Instrumentation logic will be moved out of the compiler.
(Since version 2.10.0) use parseTree(source) instead
Sets sync var response
to the fully attributed & typechecked tree contained in source
.
Sets sync var response
to the fully attributed & typechecked tree contained in source
.
(Since version 2.10.1) Use askLoadedTyped
instead to avoid race conditions in the typechecker
Deprecated because of race conditions in the typechecker when the background compiler
is interrupted while typing the same source
.
SI-6578
A hook that lets subclasses of Global
define whether a package or class should be kept loaded for the
next compiler run.
A hook that lets subclasses of Global
define whether a package or class should be kept loaded for the
next compiler run. If the parameter sym
is a class or object, and clearOnNextRun(sym)
returns true
,
then the symbol is unloaded and reset to its state before the last compiler run. If the parameter sym
is
a package, and clearOnNextRun(sym) returns
true, the package is recursively searched for
classes to drop.
Example: Let's say I want a compiler that drops all classes corresponding to the current project
between runs. Then keepForNextRun
of a toplevel class or object should return true
if the
class or object does not form part of the current project, false
otherwise. For a package,
clearOnNextRun should return true
if no class in that package forms part of the current project,
false
otherwise.
A class symbol, object symbol, package, or package class.
(Since version 2.10.0) use invalidateClassPathEntries instead
(Since version 2.10.0) Moved to tree.duplicate
(Since version 2.10.0) SI-6458: Instrumentation logic will be moved out of the compiler.
(Since version 2.10.0) The compiler doesn't use this so you shouldn't either - it will be removed
(Since version 2.10.1) Renamed to reportThrowable
(Since version 2.9.0) Use forInteractive or forScaladoc, depending on what you're after
(Since version 2.10.0) use genPolyType(...) instead
The compilation unit corresponding to a position
The compilation unit corresponding to a position
(Since version 2.10.0) use getUnitOf(pos.source) or onUnitOf(pos.source) instead
The compilation unit corresponding to a source file if it does not yet exist create a new one atomically Note: We want to get roid of this operation as it messes compiler invariants.
The compilation unit corresponding to a source file if it does not yet exist create a new one atomically Note: We want to get roid of this operation as it messes compiler invariants.
(Since version 2.10.0) use getUnitOf(s) or onUnitOf(s) instead
(Since version 2.9.0)
(global: ArrowAssoc[Global]).x
(Since version 2.10.0) Use leftOfArrow
instead
(global: Ensuring[Global]).x
(Since version 2.10.0) Use resultOfEnsuring
instead
The main class of the presentation compiler in an interactive environment such as an IDE