object TreeOps
Stateless helper functions on scala.meta.Tree.
- Alphabetic
- By Inheritance
- TreeOps
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def assertValidParens(open: Token, close: Token): Unit
- def childOf(tok: Token, tree: Tree, owners: Map[TokenHash, Tree]): Boolean
- final def childOf(child: Tree, tree: Tree): Boolean
- Annotations
- @tailrec()
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def defBody(tree: Tree): Option[Tree]
- def defDefReturnType(tree: Tree): Option[Type]
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def existsChild(f: (Tree) => Boolean)(tree: Tree): Boolean
Returns true tree has a child for which f(child) is true.
- def existsParentOfType[A <: Tree](tree: Tree)(implicit classifier: Classifier[Tree, A]): Boolean
Returns true if a matching ancestor of a given type exists.
Returns true if a matching ancestor of a given type exists.
- Annotations
- @inline()
- def extractStatementsIfAny(tree: Tree): Seq[Tree]
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def findSiblingGuard(generator: Generator): Option[Guard]
- def findTreeWithParent(tree: Tree)(pred: (Tree) => Option[Boolean]): Option[Tree]
Returns first ancestor whose parent matches the given predicate.
Returns first ancestor whose parent matches the given predicate.
- Annotations
- @tailrec()
- def findTreeWithParentOfType[A <: Tree](tree: Tree)(implicit classifier: Classifier[Tree, A]): Option[Tree]
Returns first ancestor with a parent of a given type.
- def getAssignAtSingleArgCallSite(tree: Tree): Option[Assign]
- def getBlockSingleStat(b: Block): Option[Stat]
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def getDequeueSpots(tree: Tree): Set[TokenHash]
- def getEnumStatements(enums: Seq[Enumerator]): Seq[Enumerator]
- def getMatchingParentheses(tokens: Tokens): Map[TokenHash, Token]
Finds matching parens [({})].
Finds matching parens [({})].
Contains lookup keys in both directions, opening [({ and closing })].
- def getOwners(tree: Tree): Map[TokenHash, Tree]
Creates lookup table from token offset to its closest scala.meta tree.
- final def getSelectChain(child: Tree, accum: Vector[Select]): Vector[Select]
- Annotations
- @tailrec()
- def getStatementStarts(tree: Tree): Map[TokenHash, Tree]
- def getTermLineSpan(b: Tree): Int
- def getTermSingleStat(t: Term): Option[Tree]
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isApplyInfix(op: Ident, owner: Tree): Boolean
- def isBlockFunction(fun: Function): Boolean
- Annotations
- @tailrec()
- def isCallSite(tree: Tree): Boolean
- def isChainApplyParent(parent: Tree, child: Tree): Boolean
- def isDefDef(tree: Tree): Boolean
- def isDefnOrCallSite(tree: Tree): Boolean
- def isDefnSite(tree: Tree): Boolean
Returns
trueif the Tree is a definition siteReturns
trueif the Tree is a definition siteCurrently, this includes everything from classes and defs to type applications
- def isDefnSiteWithParams(tree: Tree): Boolean
Returns
trueif the Tree is a class, trait or defReturns
trueif the Tree is a class, trait or defFor classes this includes primary and secondary Ctors.
- def isExplicitImplicit(m: Mod): Boolean
- def isFirstOrLastToken(token: Token, owner: Tree): Boolean
- def isFunctionWithBraces(fun: Function): Boolean
- def isHiddenImplicit(m: Mod): Boolean
In cases like:
In cases like:
class X( implicit private[this] val i1: Int, private[this] var i2: String )
val i1, andvar i2have awith empty tokens.Mod.Implicit - final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isModPrivateProtected(tree: Tree): Boolean
- def isProcedureSyntax(defn: Def): Boolean
- def isSingleElement(elements: List[Tree], value: Tree): Boolean
- def isSuperfluousParenthesis(open: LeftParen, owner: Tree): Boolean
- def isSuperfluousParenthesis(open: Token, owner: Tree): Boolean
Returns true if open is "unnecessary".
Returns true if open is "unnecessary".
An opening parenthesis is unnecessary if without it and its closing parenthesis can be removed without changing the AST. For example:
(a(1))will parse into the same tree asa(1). - def isTopLevel(tree: Tree): Boolean
- final def isTopLevelInfixApplication(child: Tree): Boolean
- Annotations
- @tailrec()
- def isTuple(tree: Tree): Boolean
- def isTypeVariant(tree: Tree): Boolean
- def isXmlBrace(owner: Tree): Boolean
- final def lastLambda(first: Function): Function
- Annotations
- @tailrec()
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def nestedApplies(tree: Tree): Int
How many parents of tree are Term.Apply?
- def nestedSelect(tree: Tree): Int
- def noSpaceBeforeOpeningParen(tree: Tree): Boolean
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def numParents(tree: Tree, accum: Int = 0): Int
- Annotations
- @tailrec()
- val splitCallIntoParts: PartialFunction[Tree, CallParts]
- val splitDefnIntoParts: PartialFunction[Tree, DefnParts]
- def startsSelectChain(tree: Tree): Boolean
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def topTypeWith(typeWith: With): With
- Annotations
- @tailrec()
- def treeDepth(tree: Tree): Int
Calculates depth to deepest child in tree.
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- def withChain(top: Tree): Seq[With]
- object MaybeTopLevelStat
- object SplitCallIntoParts
- object SplitDefnIntoParts