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
- val DefDefReturnTypeLeft: ExtractFromMeta[Type]
- val DefDefReturnTypeRight: ExtractFromMeta[Type]
- val SplitAssignIntoPartsLeft: ExtractFromMeta[AssignParts]
- 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 cannotStartSelectChainOnExpr(expr: Term): 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 defDefBody(tree: Tree): Option[Tree]
- Annotations
- @tailrec()
- 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 existsIfWithoutElse(tree: Tree): Boolean
- def existsIfWithoutElse(t: If): Boolean
- 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 findTreeEx(tree: Tree)(pred: (Tree) => Option[Tree]): Option[Tree]
Returns first tree which matches the given predicate.
Returns first tree which matches the given predicate. The predicate returns None to indicate failure; or the tree to recurse to; if the tree is null (or the same as current tree), the current tree is returned.
- Annotations
- @tailrec()
- def findTreeOrParent(tree: Tree)(pred: (Tree) => Option[Boolean]): Option[Tree]
Returns first ancestor which matches the given predicate.
- 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. The predicate returns None to continue with the parent, or the boolean match flag, which terminates the search.
- def findTreeWithParentEx(tree: Tree)(pred: (Tree) => Option[Tree]): Option[Tree]
Returns first ancestor whose parent matches the given predicate.
Returns first ancestor whose parent matches the given predicate. The predicate returns None to indicate failure; or the tree to recurse to; if the recurse-to tree is null, the current tree is returned.
- 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]
- final def followedBySelectOrApply(tree: Tree): Boolean
- Annotations
- @tailrec()
- def getAndOrTypeRhs(tree: Tree): Option[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 getEnumStatements(enums: Seq[Enumerator]): Seq[Enumerator]
- def getLastCall(tree: Tree): Tree
- Annotations
- @inline()
- def getMatchingParentheses(tokens: Iterable[Token]): Map[TokenHash, Token]
Finds matching parens [({})].
Finds matching parens [({})].
Contains lookup keys in both directions, opening [({ and closing })].
- def getStartOfTemplateBody(template: Template): Option[Token]
- def getStatementStarts(tree: Tree, replacedWith: (Token) => Token, soft: SoftKeywordClasses): Map[TokenHash, Tree]
- def getStripMarginChar(ft: FormatToken): Option[Char]
- def getStripMarginChar(t: Tree): Option[Char]
- def getTemplateGroups(template: Template): Option[Seq[List[Tree]]]
- final def getTopAndOrType(tree: Tree): Tree
- Annotations
- @tailrec()
- def getTreeLineSpan(b: Tree): Int
- def getTreeSingleStat(t: Tree): Option[Tree]
- def hasExplicitImplicit(param: Param): Boolean
- def hasSingleTermStat(t: Block): Boolean
- def hasSingleTermStatIfBlock(t: Tree): 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: FunctionTerm): Boolean
- Annotations
- @tailrec()
- def isCallSite(tree: Tree)(implicit style: ScalafmtConfig): Boolean
- def isCaseBodyABlock(ft: FormatToken, caseStat: CaseTree): 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, enum or defReturns
trueif thescala.meta.Treeis a class, trait, enum or defFor classes this includes primary and secondary Ctors.
- def isExplicitImplicit(m: Mod): Boolean
- def isFirstInit(t: Template, owner: Tree): 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 isTreeMultiStatBlock(tree: Tree): Boolean
- 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: FunctionTerm): FunctionTerm
- 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 splitAssignIntoParts: PartialFunction[Tree, AssignParts]
- 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, res: Seq[With] = Seq.empty): Seq[With]
- Annotations
- @tailrec()
- object EndOfFirstCall
- object SplitAssignIntoParts
- object SplitCallIntoParts
- object SplitDefnIntoParts