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 asInfixApp(tree: Tree, flag: Boolean = true): Option[InfixApp]
- Annotations
- @inline()
- final def asInfixApp(tree: Tree): Option[InfixApp]
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def assertValidParens(open: Token, close: Token): Unit
- def cannotStartSelectChain(select: Select): Boolean
- final def childOf(child: Tree, tree: Tree): Boolean
- 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 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 findFirstTreeBetween(tree: Tree, beg: Token, end: Token): Option[Tree]
- Annotations
- @tailrec()
- def findInterpolate(tree: Tree, res: Option[Interpolate] = None): Option[Interpolate]
- Annotations
- @tailrec()
- def findNextInfixInParent(tree: Tree, scope: Tree): Option[Name]
- Annotations
- @tailrec()
- def findTreeOrParent(tree: Tree)(pred: (Tree) => Option[Boolean]): Option[Tree]
Returns first ancestor which matches the given predicate.
Returns first ancestor which matches the given predicate.
- Annotations
- @tailrec()
- def findTreeOrParentSimple(tree: Tree, flag: Boolean = true)(pred: (Tree) => Boolean): Option[Tree]
- 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 findTreeWithParentSimple(tree: Tree, flag: Boolean = true)(pred: (Tree) => Boolean): Option[Tree]
- 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.
- def getStatementStarts(tree: Tree): Map[TokenHash, Tree]
- def getStripMarginChar(ft: FormatToken): Option[Char]
- def getStripMarginChar(t: Tree): Option[Char]
- def getTermLineSpan(b: Tree): Int
- def getTermSingleStat(t: Term): Option[Tree]
- def hasExplicitImplicit(param: Param): Boolean
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def ifWithoutElse(t: If): Boolean
- Annotations
- @inline()
- def infixSequenceLength(app: InfixApp): Int
- def isBlockFunction(fun: Function): Boolean
- Annotations
- @tailrec()
- def isCallSite(tree: Tree)(implicit style: ScalafmtConfig): Boolean
- def isCaseBodyABlock(ft: FormatToken, caseStat: Case): Boolean
- def isChildOfCaseClause(tree: Tree): Boolean
- def isDefDef(tree: Tree): Boolean
- def isDefnOrCallSite(tree: Tree)(implicit style: ScalafmtConfig): Boolean
- def isDefnSite(tree: Tree): Boolean
Returns
trueif thescala.meta.Treeis a definition siteReturns
trueif thescala.meta.Treeis a definition siteCurrently, this includes everything from classes and defs to type applications
- def isDefnSiteWithParams(tree: Tree): Boolean
Returns
trueif thescala.meta.Treeis a class, trait or defReturns
trueif thescala.meta.Treeis a class, trait or defFor classes this includes primary and secondary Ctors.
- def isExplicitImplicit(m: Mod): Boolean
- def isFirstOrLastToken(token: Token, owner: Tree): Boolean
- Annotations
- @inline()
- def isFirstToken(token: Token, owner: Tree): Boolean
- Annotations
- @inline()
- 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 isInfixApp(tree: Tree): Boolean
- Annotations
- @inline()
- final def isInfixOp(tree: Tree): Boolean
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isLastToken(token: Token, owner: Tree): Boolean
- Annotations
- @inline()
- 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 isTripleQuote(syntax: String): Boolean
- Annotations
- @inline()
- 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)(implicit style: ScalafmtConfig): Boolean
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def numParents(tree: Tree, cnt: Int = 0)(f: (Tree) => Boolean): Int
- Annotations
- @tailrec()
- def shouldNotDangleAtDefnSite(tree: Tree, isVerticalMultiline: Boolean)(implicit style: ScalafmtConfig): Boolean
- val splitCallIntoParts: PartialFunction[Tree, CallParts]
- val splitDefnIntoParts: PartialFunction[Tree, DefnParts]
- 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 EndOfFirstCall
- object MaybeTopLevelStat
- object SplitCallIntoParts
- object SplitDefnIntoParts