object TreeOps

Stateless helper functions on scala.meta.Tree.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. TreeOps
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. type AssignParts = (Tree, Option[Seq[Seq[Param]]])
  2. type CallParts = (Tree, Either[Seq[Tree], Seq[Seq[Tree]]])
  3. type DefnParts = (Seq[Mod], Name, Seq[Param], Seq[Seq[Param]])

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. val DefDefReturnTypeLeft: ExtractFromMeta[Type]
  5. val DefDefReturnTypeRight: ExtractFromMeta[Type]
  6. val SplitAssignIntoPartsLeft: ExtractFromMeta[AssignParts]
  7. final def asInfixApp(tree: Tree, flag: Boolean = true): Option[InfixApp]
    Annotations
    @inline()
  8. final def asInfixApp(tree: Tree): Option[InfixApp]
  9. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  10. def assertValidParens(open: Token, close: Token): Unit
  11. def cannotStartSelectChainOnExpr(expr: Term): Boolean
  12. final def childOf(child: Tree, tree: Tree): Boolean
  13. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  14. def defDefBody(tree: Tree): Option[Tree]
    Annotations
    @tailrec()
  15. def defDefReturnType(tree: Tree): Option[Type]
  16. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  18. def existsIfWithoutElse(tree: Tree): Boolean
  19. def existsIfWithoutElse(t: If): Boolean
  20. 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()
  21. def extractStatementsIfAny(tree: Tree): Seq[Tree]
  22. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  23. def findFirstTreeBetween(tree: Tree, beg: Token, end: Token): Option[Tree]
    Annotations
    @tailrec()
  24. def findInterpolate(tree: Tree, res: Option[Interpolate] = None): Option[Interpolate]
    Annotations
    @tailrec()
  25. def findNextInfixInParent(tree: Tree, scope: Tree): Option[Name]
    Annotations
    @tailrec()
  26. 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()
  27. def findTreeOrParent(tree: Tree)(pred: (Tree) => Option[Boolean]): Option[Tree]

    Returns first ancestor which matches the given predicate.

  28. def findTreeOrParentSimple(tree: Tree, flag: Boolean = true)(pred: (Tree) => Boolean): Option[Tree]
  29. 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.

  30. 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()
  31. def findTreeWithParentOfType[A <: Tree](tree: Tree)(implicit classifier: Classifier[Tree, A]): Option[Tree]

    Returns first ancestor with a parent of a given type.

  32. def findTreeWithParentSimple(tree: Tree, flag: Boolean = true)(pred: (Tree) => Boolean): Option[Tree]
  33. final def followedBySelectOrApply(tree: Tree): Boolean
    Annotations
    @tailrec()
  34. def getAndOrTypeRhs(tree: Tree): Option[Type]
  35. def getAssignAtSingleArgCallSite(tree: Tree): Option[Assign]
  36. def getBlockSingleStat(b: Block): Option[Stat]
  37. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  38. def getEnumStatements(enums: Seq[Enumerator]): Seq[Enumerator]
  39. def getLastCall(tree: Tree): Tree
    Annotations
    @inline()
  40. def getMatchingParentheses(tokens: Iterable[Token]): Map[TokenHash, Token]

    Finds matching parens [({})].

    Finds matching parens [({})].

    Contains lookup keys in both directions, opening [({ and closing })].

  41. def getStartOfTemplateBody(template: Template): Option[Token]
  42. def getStatementStarts(tree: Tree, replacedWith: (Token) => Token, soft: SoftKeywordClasses): Map[TokenHash, Tree]
  43. def getStripMarginChar(ft: FormatToken): Option[Char]
  44. def getStripMarginChar(t: Tree): Option[Char]
  45. def getTemplateGroups(template: Template): Option[Seq[List[Tree]]]
  46. final def getTopAndOrType(tree: Tree): Tree
    Annotations
    @tailrec()
  47. def getTreeLineSpan(b: Tree): Int
  48. def getTreeSingleStat(t: Tree): Option[Tree]
  49. def hasExplicitImplicit(param: Param): Boolean
  50. def hasSingleTermStat(t: Block): Boolean
  51. def hasSingleTermStatIfBlock(t: Tree): Boolean
  52. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  53. def ifWithoutElse(t: If): Boolean
    Annotations
    @inline()
  54. def infixSequenceLength(app: InfixApp): Int
  55. def isBlockFunction(fun: FunctionTerm): Boolean
    Annotations
    @tailrec()
  56. def isCallSite(tree: Tree)(implicit style: ScalafmtConfig): Boolean
  57. def isCaseBodyABlock(ft: FormatToken, caseStat: CaseTree): Boolean
  58. def isChildOfCaseClause(tree: Tree): Boolean
  59. def isDefDef(tree: Tree): Boolean
  60. def isDefnOrCallSite(tree: Tree)(implicit style: ScalafmtConfig): Boolean
  61. def isDefnSite(tree: Tree): Boolean

    Returns true if the scala.meta.Tree is a definition site

    Returns true if the scala.meta.Tree is a definition site

    Currently, this includes everything from classes and defs to type applications

  62. def isDefnSiteWithParams(tree: Tree): Boolean

    Returns true if the scala.meta.Tree is a class, trait, enum or def

    Returns true if the scala.meta.Tree is a class, trait, enum or def

    For classes this includes primary and secondary Ctors.

  63. def isExplicitImplicit(m: Mod): Boolean
  64. def isFirstInit(t: Template, owner: Tree): Boolean
  65. def isFirstOrLastToken(token: Token, owner: Tree): Boolean
    Annotations
    @inline()
  66. def isFirstToken(token: Token, owner: Tree): Boolean
    Annotations
    @inline()
  67. def isFunctionWithBraces(fun: Function): Boolean
  68. 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, and var i2 have a Mod.Implicit with empty tokens.

  69. final def isInfixApp(tree: Tree): Boolean
    Annotations
    @inline()
  70. final def isInfixOp(tree: Tree): Boolean
  71. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  72. def isLastToken(token: Token, owner: Tree): Boolean
    Annotations
    @inline()
  73. def isModPrivateProtected(tree: Tree): Boolean
  74. def isProcedureSyntax(defn: Def): Boolean
  75. def isSingleElement(elements: List[Tree], value: Tree): Boolean
  76. def isSuperfluousParenthesis(open: LeftParen, owner: Tree): Boolean
  77. 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 as a(1).

  78. def isTreeMultiStatBlock(tree: Tree): Boolean
  79. def isTripleQuote(syntax: String): Boolean
    Annotations
    @inline()
  80. def isTuple(tree: Tree): Boolean
  81. def isTypeVariant(tree: Tree): Boolean
  82. def isXmlBrace(owner: Tree): Boolean
  83. final def lastLambda(first: FunctionTerm): FunctionTerm
    Annotations
    @tailrec()
  84. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  85. def nestedApplies(tree: Tree): Int

    How many parents of tree are Term.Apply?

  86. def nestedSelect(tree: Tree): Int
  87. def noSpaceBeforeOpeningParen(tree: Tree)(implicit style: ScalafmtConfig): Boolean
  88. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  89. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  90. final def numParents(tree: Tree, cnt: Int = 0)(f: (Tree) => Boolean): Int
    Annotations
    @tailrec()
  91. def shouldNotDangleAtDefnSite(tree: Tree, isVerticalMultiline: Boolean)(implicit style: ScalafmtConfig): Boolean
  92. val splitAssignIntoParts: PartialFunction[Tree, AssignParts]
  93. val splitCallIntoParts: PartialFunction[Tree, CallParts]
  94. val splitDefnIntoParts: PartialFunction[Tree, DefnParts]
  95. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  96. def toString(): String
    Definition Classes
    AnyRef → Any
  97. def topTypeWith(typeWith: With): With
    Annotations
    @tailrec()
  98. def treeDepth(tree: Tree): Int

    Calculates depth to deepest child in tree.

  99. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  100. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  101. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  102. def withChain(top: Tree, res: Seq[With] = Seq.empty): Seq[With]
    Annotations
    @tailrec()
  103. object EndOfFirstCall
  104. object SplitAssignIntoParts
  105. object SplitCallIntoParts
  106. object SplitDefnIntoParts

Inherited from AnyRef

Inherited from Any

Ungrouped