NavigateAST

object NavigateAST

Utility functions to go from typed to untyped ASTs

class Object
trait Matchable
class Any

Value members

Concrete methods

def pathTo(span: Span, from: Positioned, skipZeroExtent: Boolean)(using Context): List[Positioned]

The reverse path from node from to the node that closest encloses span, or Nil if no such path exists. If a non-empty path is returned it starts with the node closest enclosing span and ends with from.

The reverse path from node from to the node that closest encloses span, or Nil if no such path exists. If a non-empty path is returned it starts with the node closest enclosing span and ends with from.

Value Params
skipZeroExtent

If true, skip over zero-extent nodes in the search. These nodes do not correspond to code the user wrote since their start and end point are the same, so this is useful when trying to reconcile nodes with source code.

def toUntyped(tree: Tree)(using Context): Tree

The untyped tree corresponding to typed tree tree in the compilation unit specified by ctx

The untyped tree corresponding to typed tree tree in the compilation unit specified by ctx

def untypedPath(tree: Tree, exactMatch: Boolean)(using Context): List[Positioned]

The reverse path of untyped trees starting with a tree that closest matches tree and ending in the untyped tree at the root of the compilation unit specified by ctx.

The reverse path of untyped trees starting with a tree that closest matches tree and ending in the untyped tree at the root of the compilation unit specified by ctx.

Value Params
exactMatch

If true, the path must start with a node that exactly matches tree, or Nil is returned. If false the path might start with a node enclosing the logical position of tree. Note: A complication concerns member definitions. ValDefs and DefDefs have after desugaring a position that spans just the name of the symbol being defined and nothing else. So we look instead for an untyped tree approximating the envelope of the definition, and declare success if we find another DefTree.

def untypedPath(span: Span)(using Context): List[Positioned]

The reverse part of the untyped root of the compilation unit of ctx to the given span.

The reverse part of the untyped root of the compilation unit of ctx to the given span.