Interactive

dotty.tools.dotc.interactive.Interactive$

High-level API to get information out of typed trees, designed to be used by IDEs.

Attributes

See also:

InteractiveDriver to get typed trees from code.

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Concise view

Type members

Classlikes

object Include

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Include.type

Value members

Concrete methods

def contextOfPath(path: List[Tree])(using Context): Context
def contextOfStat(stats: List[Tree], stat: Tree, exprOwner: Symbol, ctx: Context): Context

The first tree in the path that is a definition.

The first tree in the path that is a definition.

Attributes

The source symbols that are the closest to path.

The source symbols that are the closest to path.

If this path ends in an import, then this returns all the symbols that are imported by this import statement.

Attributes

path

The path to the tree whose symbols to extract.

Returns:

The source symbols that are the closest to path.

See also:

sourceSymbol

The closest enclosing tree with a symbol containing position pos, or the EmptyTree.

The closest enclosing tree with a symbol containing position pos, or the EmptyTree.

Attributes

def enclosingTree(path: List[Tree])(using Context): Tree

The closest enclosing tree with a symbol, or the EmptyTree.

The closest enclosing tree with a symbol, or the EmptyTree.

Attributes

The type of the closest enclosing tree with a type containing position pos.

The type of the closest enclosing tree with a type containing position pos.

Attributes

Find the definitions of the symbol at the end of path. In the case of an import node, all imported symbols will be considered.

Find the definitions of the symbol at the end of path. In the case of an import node, all imported symbols will be considered.

Attributes

driver

The driver responsible for path.

path

The path to the symbol for which we want the definitions.

Returns:

The definitions for the symbol at the end of path.

def findDefinitions(symbols: List[Symbol], driver: InteractiveDriver, includeOverridden: Boolean, includeExternal: Boolean): List[SourceTree]

Find the definitions of symbols.

Find the definitions of symbols.

Attributes

driver

The driver responsible for the given symbols.

includeExternal

If true, also look for definitions on the classpath.

includeOverridden

If true, also include the symbols overridden by any of symbols.

symbols

The list of symbols for which to find a definition.

Returns:

The definitions for the symbols in symbols, and if includeOverridden is set, the definitions for the symbols that they override.

def findTreesMatching(trees: List[SourceTree], includes: Set, symbol: Symbol, predicate: NameTree => Boolean)(using Context): List[SourceTree]

Find trees that match symbol in trees.

Find trees that match symbol in trees.

Attributes

includes

Whether to include references, definitions, etc.

predicate

An additional predicate that the trees must match.

symbol

The symbol for which we want to find references.

trees

The trees to inspect.

Return a predicate function that determines whether a given NameTree is an implementation of sym.

Return a predicate function that determines whether a given NameTree is an implementation of sym.

Attributes

sym

The symbol whose implementations to find.

Returns:

A function that determines whether a NameTree is an implementation of sym.

Does this tree define a symbol ?

Does this tree define a symbol ?

Attributes

def isRenamed(tree: NameTree)(using Context): Boolean

Is this tree using a renaming introduced by an import statement or an alias for this?

Is this tree using a renaming introduced by an import statement or an alias for this?

Attributes

tree

The tree to inspect

Returns:

True, if this tree's name is different than its symbol's name, indicating that it uses a renaming introduced by an import statement or an alias for this.

def localize(symbol: Symbol, sourceDriver: InteractiveDriver, targetDriver: InteractiveDriver): Symbol

Given sym, originating from sourceDriver, find its representation in targetDriver.

Given sym, originating from sourceDriver, find its representation in targetDriver.

Attributes

sourceDriver

The driver from which symbol originates.

symbol

The symbol to expression in the new driver.

targetDriver

The driver in which we want to get a representation of symbol.

Returns:

A representation of symbol in targetDriver.

def matchSymbol(tree: Tree, sym: Symbol, include: Set)(using Context): Boolean

Check if tree matches sym. This is the case if the symbol defined by tree equals sym, or the source symbol of tree equals sym, or include is overridden, and tree is overridden by sym, or include is overriding, and tree overrides sym.

Check if tree matches sym. This is the case if the symbol defined by tree equals sym, or the source symbol of tree equals sym, or include is overridden, and tree is overridden by sym, or include is overriding, and tree overrides sym.

Attributes

def namedTrees(trees: List[SourceTree], include: Set, sym: Symbol)(using Context): List[SourceTree]

Find named trees with a non-empty position whose symbol match sym in trees.

Find named trees with a non-empty position whose symbol match sym in trees.

Note that nothing will be found for symbols not defined in source code, use sourceSymbol to get a symbol related to sym that is defined in source code.

Attributes

def namedTrees(trees: List[SourceTree], include: Set, treePredicate: NameTree => Boolean)(using Context): List[SourceTree]

Find named trees with a non-empty position satisfying treePredicate in trees.

Find named trees with a non-empty position satisfying treePredicate in trees.

Attributes

include

Whether to include references, definitions, etc.

treePredicate

An additional predicate that the trees must match.

trees

The trees to inspect.

Returns:

The trees with a non-empty position satisfying treePredicate.

def pathTo(trees: List[SourceTree], pos: SourcePosition)(using Context): List[Tree]

The reverse path to the node that closest encloses position pos, or Nil if no such path exists. If a non-empty path is returned it starts with the tree closest enclosing pos and ends with an element of trees.

The reverse path to the node that closest encloses position pos, or Nil if no such path exists. If a non-empty path is returned it starts with the tree closest enclosing pos and ends with an element of trees.

Note that if the given pos points out places for incomplete parses, this method returns errorTermTree (Literal(Consotant(null)).

Attributes

See also:
def pathTo(tree: Tree, span: Span)(using Context): List[Tree]
def sameName(n0: Name, n1: Name): Boolean

Are the two names the same?

Are the two names the same?

Attributes