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 CallParts = (Tree, Either[Seq[Tree], Seq[Seq[Tree]]])
  2. 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. final def asInfixApp(tree: Tree, flag: Boolean = true): Option[InfixApp]
    Annotations
    @inline()
  5. final def asInfixApp(tree: Tree): Option[InfixApp]
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def assertValidParens(open: Token, close: Token): Unit
  8. def cannotStartSelectChain(select: Select): Boolean
  9. final def childOf(child: Tree, tree: Tree): Boolean
  10. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  11. def defBody(tree: Tree): Option[Tree]
  12. def defDefReturnType(tree: Tree): Option[Type]
  13. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  15. 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()
  16. def extractStatementsIfAny(tree: Tree): Seq[Tree]
  17. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  18. def findFirstTreeBetween(tree: Tree, beg: Token, end: Token): Option[Tree]
    Annotations
    @tailrec()
  19. def findInterpolate(tree: Tree, res: Option[Interpolate] = None): Option[Interpolate]
    Annotations
    @tailrec()
  20. def findNextInfixInParent(tree: Tree, scope: Tree): Option[Name]
    Annotations
    @tailrec()
  21. 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()
  22. def findTreeOrParentSimple(tree: Tree, flag: Boolean = true)(pred: (Tree) => Boolean): Option[Tree]
  23. 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()
  24. def findTreeWithParentOfType[A <: Tree](tree: Tree)(implicit classifier: Classifier[Tree, A]): Option[Tree]

    Returns first ancestor with a parent of a given type.

  25. def findTreeWithParentSimple(tree: Tree, flag: Boolean = true)(pred: (Tree) => Boolean): Option[Tree]
  26. def getAssignAtSingleArgCallSite(tree: Tree): Option[Assign]
  27. def getBlockSingleStat(b: Block): Option[Stat]
  28. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  29. def getDequeueSpots(tree: Tree): Set[TokenHash]
  30. def getEnumStatements(enums: Seq[Enumerator]): Seq[Enumerator]
  31. def getMatchingParentheses(tokens: Tokens): Map[TokenHash, Token]

    Finds matching parens [({})].

    Finds matching parens [({})].

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

  32. def getOwners(tree: Tree): Map[TokenHash, Tree]

    Creates lookup table from token offset to its closest scala.meta tree.

  33. def getStatementStarts(tree: Tree): Map[TokenHash, Tree]
  34. def getStripMarginChar(ft: FormatToken): Option[Char]
  35. def getStripMarginChar(t: Tree): Option[Char]
  36. def getTermLineSpan(b: Tree): Int
  37. def getTermSingleStat(t: Term): Option[Tree]
  38. def hasExplicitImplicit(param: Param): Boolean
  39. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  40. def ifWithoutElse(t: If): Boolean
    Annotations
    @inline()
  41. def infixSequenceLength(app: InfixApp): Int
  42. def isBlockFunction(fun: Function): Boolean
    Annotations
    @tailrec()
  43. def isCallSite(tree: Tree)(implicit style: ScalafmtConfig): Boolean
  44. def isCaseBodyABlock(ft: FormatToken, caseStat: Case): Boolean
  45. def isChildOfCaseClause(tree: Tree): Boolean
  46. def isDefDef(tree: Tree): Boolean
  47. def isDefnOrCallSite(tree: Tree)(implicit style: ScalafmtConfig): Boolean
  48. 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

  49. def isDefnSiteWithParams(tree: Tree): Boolean

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

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

    For classes this includes primary and secondary Ctors.

  50. def isExplicitImplicit(m: Mod): Boolean
  51. def isFirstOrLastToken(token: Token, owner: Tree): Boolean
    Annotations
    @inline()
  52. def isFirstToken(token: Token, owner: Tree): Boolean
    Annotations
    @inline()
  53. def isFunctionWithBraces(fun: Function): Boolean
  54. 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.

  55. final def isInfixApp(tree: Tree): Boolean
    Annotations
    @inline()
  56. final def isInfixOp(tree: Tree): Boolean
  57. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  58. def isLastToken(token: Token, owner: Tree): Boolean
    Annotations
    @inline()
  59. def isModPrivateProtected(tree: Tree): Boolean
  60. def isProcedureSyntax(defn: Def): Boolean
  61. def isSingleElement(elements: List[Tree], value: Tree): Boolean
  62. def isSuperfluousParenthesis(open: LeftParen, owner: Tree): Boolean
  63. 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).

  64. def isTripleQuote(syntax: String): Boolean
    Annotations
    @inline()
  65. def isTuple(tree: Tree): Boolean
  66. def isTypeVariant(tree: Tree): Boolean
  67. def isXmlBrace(owner: Tree): Boolean
  68. final def lastLambda(first: Function): Function
    Annotations
    @tailrec()
  69. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  70. def nestedApplies(tree: Tree): Int

    How many parents of tree are Term.Apply?

  71. def nestedSelect(tree: Tree): Int
  72. def noSpaceBeforeOpeningParen(tree: Tree)(implicit style: ScalafmtConfig): Boolean
  73. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  74. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  75. final def numParents(tree: Tree, cnt: Int = 0)(f: (Tree) => Boolean): Int
    Annotations
    @tailrec()
  76. def shouldNotDangleAtDefnSite(tree: Tree, isVerticalMultiline: Boolean)(implicit style: ScalafmtConfig): Boolean
  77. val splitCallIntoParts: PartialFunction[Tree, CallParts]
  78. val splitDefnIntoParts: PartialFunction[Tree, DefnParts]
  79. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  80. def toString(): String
    Definition Classes
    AnyRef → Any
  81. def topTypeWith(typeWith: With): With
    Annotations
    @tailrec()
  82. def treeDepth(tree: Tree): Int

    Calculates depth to deepest child in tree.

  83. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  84. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  85. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  86. def withChain(top: Tree): Seq[With]
  87. object EndOfFirstCall
  88. object MaybeTopLevelStat
  89. object SplitCallIntoParts
  90. object SplitDefnIntoParts

Inherited from AnyRef

Inherited from Any

Ungrouped