Object

org.scalafmt.util

TreeOps

Related Doc: package util

Permalink

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. All

Type Members

  1. type CallParts = (Tree, Either[Seq[Tree], Seq[Seq[Tree]]])

    Permalink
  2. type DefnParts = (Seq[Mod], Name, Seq[Param], Seq[Seq[Param]])

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. object EndOfFirstCall

    Permalink
  5. object MaybeTopLevelStat

    Permalink
  6. object SplitCallIntoParts

    Permalink
  7. object SplitDefnIntoParts

    Permalink
  8. final def asInfixApp(tree: Tree, flag: Boolean = true): Option[InfixApp]

    Permalink
    Annotations
    @inline()
  9. final def asInfixApp(tree: Tree): Option[InfixApp]

    Permalink
  10. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  11. def assertValidParens(open: Token, close: Token): Unit

    Permalink
  12. def childOf(tok: Token, tree: Tree, owners: Map[TokenHash, Tree]): Boolean

    Permalink
  13. final def childOf(child: Tree, tree: Tree): Boolean

    Permalink
    Annotations
    @tailrec()
  14. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  15. def defBody(tree: Tree): Option[Tree]

    Permalink
  16. def defDefReturnType(tree: Tree): Option[Type]

    Permalink
  17. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  18. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  19. def existsChild(f: (Tree) ⇒ Boolean)(tree: Tree): Boolean

    Permalink

    Returns true tree has a child for which f(child) is true.

  20. def existsParentOfType[A <: Tree](tree: Tree)(implicit classifier: Classifier[Tree, A]): Boolean

    Permalink

    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]

    Permalink
  22. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  23. def findFirstTreeBetween(tree: Tree, beg: Token, end: Token): Option[Tree]

    Permalink
    Annotations
    @tailrec()
  24. def findInterpolate(tree: Tree, res: Option[Interpolate] = None): Option[Interpolate]

    Permalink
    Annotations
    @tailrec()
  25. def findNextInfixInParent(tree: Tree, scope: Tree): Option[Name]

    Permalink
    Annotations
    @tailrec()
  26. def findSiblingGuard(generator: Generator): Option[Guard]

    Permalink
  27. def findTreeWithParent(tree: Tree)(pred: (Tree) ⇒ Option[Boolean]): Option[Tree]

    Permalink

    Returns first ancestor whose parent matches the given predicate.

    Returns first ancestor whose parent matches the given predicate.

    Annotations
    @tailrec()
  28. def findTreeWithParentOfType[A <: Tree](tree: Tree)(implicit classifier: Classifier[Tree, A]): Option[Tree]

    Permalink

    Returns first ancestor with a parent of a given type.

  29. def findTreeWithParentSimple(tree: Tree)(pred: (Tree) ⇒ Boolean): Option[Tree]

    Permalink
  30. def getAssignAtSingleArgCallSite(tree: Tree): Option[Assign]

    Permalink
  31. def getBlockSingleStat(b: Block): Option[Stat]

    Permalink
  32. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  33. def getDequeueSpots(tree: Tree): Set[TokenHash]

    Permalink
  34. def getEnumStatements(enums: Seq[Enumerator]): Seq[Enumerator]

    Permalink
  35. def getMatchingParentheses(tokens: Tokens): Map[TokenHash, Token]

    Permalink

    Finds matching parens [({})].

    Finds matching parens [({})].

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

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

    Permalink

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

  37. final def getSelectChain(child: Tree, accum: Vector[Select]): Vector[Select]

    Permalink
    Annotations
    @tailrec()
  38. def getStatementStarts(tree: Tree): Map[TokenHash, Tree]

    Permalink
  39. def getStripMarginChar(ft: FormatToken): Option[Char]

    Permalink
  40. def getStripMarginChar(t: Tree): Option[Char]

    Permalink
  41. def getTermLineSpan(b: Tree): Int

    Permalink
  42. def getTermSingleStat(t: Term): Option[Tree]

    Permalink
  43. def hasExplicitImplicit(param: Param): Boolean

    Permalink
  44. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  45. def infixSequenceLength(app: InfixApp): Int

    Permalink
  46. def isBlockFunction(fun: Function): Boolean

    Permalink
    Annotations
    @tailrec()
  47. def isCallSite(tree: Tree)(implicit style: ScalafmtConfig): Boolean

    Permalink
  48. def isChainApplyParent(parent: Tree, child: Tree): Boolean

    Permalink
  49. def isChildOfCaseClause(tree: Tree): Boolean

    Permalink
  50. def isDefDef(tree: Tree): Boolean

    Permalink
  51. def isDefnOrCallSite(tree: Tree)(implicit style: ScalafmtConfig): Boolean

    Permalink
  52. def isDefnSite(tree: Tree): Boolean

    Permalink

    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

  53. def isDefnSiteWithParams(tree: Tree): Boolean

    Permalink

    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.

  54. def isExplicitImplicit(m: Mod): Boolean

    Permalink
  55. def isFirstOrLastToken(token: Token, owner: Tree): Boolean

    Permalink
  56. def isFunctionWithBraces(fun: Function): Boolean

    Permalink
  57. def isHiddenImplicit(m: Mod): Boolean

    Permalink

    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.

  58. final def isInfixApp(tree: Tree): Boolean

    Permalink
    Annotations
    @inline()
  59. final def isInfixOp(tree: Tree): Boolean

    Permalink
  60. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  61. def isModPrivateProtected(tree: Tree): Boolean

    Permalink
  62. def isProcedureSyntax(defn: Def): Boolean

    Permalink
  63. def isSingleElement(elements: List[Tree], value: Tree): Boolean

    Permalink
  64. def isSuperfluousParenthesis(open: LeftParen, owner: Tree): Boolean

    Permalink
  65. def isSuperfluousParenthesis(open: Token, owner: Tree): Boolean

    Permalink

    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).

  66. def isTopLevel(tree: Tree): Boolean

    Permalink
  67. final def isTopLevelInfixApplication(child: Tree): Boolean

    Permalink
    Annotations
    @tailrec()
  68. def isTripleQuote(token: Token): Boolean

    Permalink
  69. def isTuple(tree: Tree): Boolean

    Permalink
  70. def isTypeVariant(tree: Tree): Boolean

    Permalink
  71. def isXmlBrace(owner: Tree): Boolean

    Permalink
  72. final def lastLambda(first: Function): Function

    Permalink
    Annotations
    @tailrec()
  73. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  74. def nestedApplies(tree: Tree): Int

    Permalink

    How many parents of tree are Term.Apply?

  75. def nestedSelect(tree: Tree): Int

    Permalink
  76. def noSpaceBeforeOpeningParen(tree: Tree)(implicit style: ScalafmtConfig): Boolean

    Permalink
  77. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  78. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  79. final def numParents(tree: Tree, cnt: Int = 0)(f: (Tree) ⇒ Boolean): Int

    Permalink
    Annotations
    @tailrec()
  80. def shouldNotDangleAtDefnSite(tree: Tree, isVerticalMultiline: Boolean)(implicit style: ScalafmtConfig): Boolean

    Permalink
  81. val splitCallIntoParts: PartialFunction[Tree, CallParts]

    Permalink
  82. val splitDefnIntoParts: PartialFunction[Tree, DefnParts]

    Permalink
  83. def startsSelectChain(tree: Tree): Boolean

    Permalink
  84. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  85. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  86. def topTypeWith(typeWith: With): With

    Permalink
    Annotations
    @tailrec()
  87. def treeDepth(tree: Tree): Int

    Permalink

    Calculates depth to deepest child in tree.

  88. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  89. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  90. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  91. def withChain(top: Tree): Seq[With]

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped