abstract class TreeInfo extends AnyRef

This class ...

Version

1.0

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. TreeInfo
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new TreeInfo()

Type Members

  1. class Applied extends AnyRef

    Applications in Scala can have one of the following shapes:

    Applications in Scala can have one of the following shapes:

    1) naked core: Ident(_) or Select(_, _) or basically anything else 2) naked core with targs: TypeApply(core, targs) or AppliedTypeTree(core, targs) 3) apply or several applies wrapping a core: Apply(core, _), or Apply(Apply(core, _), _), etc

    This class provides different ways to decompose applications and simplifies their analysis.

    ***Examples*** (TypeApply in the examples can be replaced with AppliedTypeTree)

    Ident(foo): * callee = Ident(foo) * core = Ident(foo) * targs = Nil * argss = Nil

    TypeApply(foo, List(targ1, targ2...)) * callee = TypeApply(foo, List(targ1, targ2...)) * core = foo * targs = List(targ1, targ2...) * argss = Nil

    Apply(foo, List(arg1, arg2...)) * callee = foo * core = foo * targs = Nil * argss = List(List(arg1, arg2...))

    Apply(Apply(foo, List(arg21, arg22, ...)), List(arg11, arg12...)) * callee = foo * core = foo * targs = Nil * argss = List(List(arg11, arg12...), List(arg21, arg22, ...))

    Apply(Apply(TypeApply(foo, List(targs1, targs2, ...)), List(arg21, arg22, ...)), List(arg11, arg12...)) * callee = TypeApply(foo, List(targs1, targs2, ...)) * core = foo * targs = Nil * argss = List(List(arg11, arg12...), List(arg21, arg22, ...))

  2. class DynamicApplicationExtractor extends AnyRef
  3. abstract class SeeThroughBlocks[T] extends AnyRef

    Some handy extractors for spotting trees through the the haze of irrelevant braces: i.e.

    Some handy extractors for spotting trees through the the haze of irrelevant braces: i.e. Block(Nil, SomeTree) should not keep us from seeing SomeTree.

Abstract Value Members

  1. abstract val global: SymbolTable

Concrete 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 val SYNTH_CASE_FLAGS: Int
  5. def admitsTypeSelection(tree: SymbolTable.Tree): Boolean

    Is tree either a non-volatile type, or a path that does not include any of:

    Is tree either a non-volatile type, or a path that does not include any of:

    • a reference to a mutable variable/field
    • a reference to a by-name parameter
    • a member selection on a volatile type (Spec: 3.6 Volatile Types)?

    Such a tree is a suitable target for type selection.

  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def assignmentToMaybeNamedArg(tree: SymbolTable.Tree): SymbolTable.Tree

    Translates an Assign(_, _) node to AssignOrNamedArg(_, _) if the lhs is a simple ident.

    Translates an Assign(_, _) node to AssignOrNamedArg(_, _) if the lhs is a simple ident. Otherwise returns unchanged.

  8. def catchesThrowable(cdef: SymbolTable.CaseDef): Boolean

    Does this CaseDef catch Throwable?

  9. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  10. def dissectApplied(tree: SymbolTable.Tree): Applied

    Returns a wrapper that knows how to destructure and analyze applications.

  11. def effectivePatternArity(args: List[SymbolTable.Tree]): Int

    //------------------------ => effectivePatternArity(args)
    case Extractor(a)          => 1
    case Extractor(a, b)       => 2
    case Extractor((a, b))     => 2
    case Extractor(a @ (b, c)) => 2
  12. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  14. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  15. def firstConstructor(stats: List[SymbolTable.Tree]): SymbolTable.Tree

    The first constructor definitions in stats

  16. def firstConstructorArgs(stats: List[SymbolTable.Tree]): List[SymbolTable.Tree]

    The arguments to the first constructor in stats.

  17. def firstDefinesClassOrObject(trees: List[SymbolTable.Tree], name: SymbolTable.Name): Boolean

    Does list of trees start with a definition of a class of module with given name (ignoring imports)

  18. def flattenedPatternArgs(args: List[SymbolTable.Tree]): List[SymbolTable.Tree]
  19. def foreachMethodParamAndArg(params: List[SymbolTable.Symbol], args: List[SymbolTable.Tree])(f: (SymbolTable.Symbol, SymbolTable.Tree) ⇒ Unit): Boolean
  20. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  21. def hasSynthCaseSymbol(t: SymbolTable.Tree): Boolean
  22. def hasUntypedPreSuperFields(stats: List[SymbolTable.Tree]): Boolean
  23. def hasVolatileType(tree: SymbolTable.Tree): Boolean

    Is tree's type volatile? (Ignored if its symbol has the @uncheckedStable annotation.)

  24. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  25. def isAbsTypeDef(tree: SymbolTable.Tree): Boolean
  26. def isAliasTypeDef(tree: SymbolTable.Tree): Boolean
  27. def isApplyDynamicName(name: SymbolTable.Name): Boolean
  28. def isByNameParamType(tpt: SymbolTable.Tree): Boolean

    Is tpt a by-name parameter type of the form => T?

  29. def isCatchCase(cdef: SymbolTable.CaseDef): Boolean

    Is this pattern node a catch-all or type-test pattern?

  30. def isConstructorWithDefault(t: SymbolTable.Tree): Boolean
  31. def isDeclarationOrTypeDef(tree: SymbolTable.Tree): Boolean

    Is tree a declaration or type definition?

  32. def isDefaultCase(cdef: SymbolTable.CaseDef): Boolean

    Is this pattern node a catch-all (wildcard or variable) pattern?

  33. def isDefaultGetter(tree: SymbolTable.Tree): Boolean
  34. def isEarlyDef(tree: SymbolTable.Tree): Boolean
  35. def isEarlyValDef(tree: SymbolTable.Tree): Boolean
  36. def isExprSafeToInline(tree: SymbolTable.Tree): Boolean

    Is tree an expression which can be inlined without affecting program semantics?

    Is tree an expression which can be inlined without affecting program semantics?

    Note that this is not called "isExprPure" since purity (lack of side-effects) is not the litmus test. References to modules and lazy vals are side-effecting, both because side-effecting code may be executed and because the first reference takes a different code path than all to follow; but they are safe to inline because the expression result from evaluating them is always the same.

  37. def isFunctionMissingParamType(tree: SymbolTable.Tree): Boolean
  38. def isGuardedCase(cdef: SymbolTable.CaseDef): Boolean

    Is this case guarded?

  39. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  40. def isInterfaceMember(tree: SymbolTable.Tree): Boolean

    Is tree legal as a member definition of an interface?

  41. def isLeftAssoc(operator: SymbolTable.Name): Boolean

    Is name a left-associative operator?

  42. def isLiteralString(t: SymbolTable.Tree): Boolean
  43. def isMacroApplication(tree: SymbolTable.Tree): Boolean
  44. def isMacroApplicationOrBlock(tree: SymbolTable.Tree): Boolean
  45. def isNullaryInvocation(tree: SymbolTable.Tree): Boolean
  46. def isPath(tree: SymbolTable.Tree, allowVolatile: Boolean): Boolean

    Is tree a path, defined as follows? (Spec: 3.1 Paths)

    Is tree a path, defined as follows? (Spec: 3.1 Paths)

    - The empty path ε (which cannot be written explicitly in user programs). - C.this, where C references a class. - p.x where p is a path and x is a stable member of p. - C.super.x or C.super[M].x where C references a class and x references a stable member of the super class or designated parent class M of C.

    NOTE: Trees with errors are (mostly) excluded.

    Path ::= StableId | [id ‘.’] this

  47. def isPureDef(tree: SymbolTable.Tree): Boolean

    Is tree a pure (i.e.

    Is tree a pure (i.e. non-side-effecting) definition?

  48. def isPureExprForWarningPurposes(tree: SymbolTable.Tree): Boolean

    As if the name of the method didn't give it away, this logic is designed around issuing helpful warnings and minimizing spurious ones.

    As if the name of the method didn't give it away, this logic is designed around issuing helpful warnings and minimizing spurious ones. That means don't reuse it for important matters like inlining decisions.

  49. def isQualifierSafeToElide(tree: SymbolTable.Tree): Boolean
  50. def isRepeatedParamType(tpt: SymbolTable.Tree): Boolean

    Is tpt a vararg type of the form T* ?

  51. def isSelfConstrCall(tree: SymbolTable.Tree): Boolean

    Is tree a self constructor call this(...)? I.e.

    Is tree a self constructor call this(...)? I.e. a call to a constructor of the same object?

  52. def isSelfOrSuperConstrCall(tree: SymbolTable.Tree): Boolean

    Is tree a self or super constructor call?

  53. def isSequenceValued(tree: SymbolTable.Tree): Boolean

    Is this pattern node a sequence-valued pattern?

  54. def isStableIdentifier(tree: SymbolTable.Tree, allowVolatile: Boolean): Boolean

    Is tree a stable identifier, a path which ends in an identifier?

    Is tree a stable identifier, a path which ends in an identifier?

    StableId ::= id | Path ‘.’ id | [id ’.’] ‘super’ [‘[’ id ‘]’] ‘.’ id

  55. def isStableIdentifierPattern(tree: SymbolTable.Tree): Boolean

    Is tree admissible as a stable identifier pattern (8.1.5 Stable Identifier Patterns)?

    Is tree admissible as a stable identifier pattern (8.1.5 Stable Identifier Patterns)?

    We disregard volatility, as it's irrelevant in patterns (scala/bug#6815)

  56. def isStableMemberOf(sym: SymbolTable.Symbol, tree: SymbolTable.Tree, allowVolatile: Boolean): Boolean

    Assuming sym is a member of tree, is it a "stable member"?

    Assuming sym is a member of tree, is it a "stable member"?

    Stable members are packages or members introduced by object definitions or by value definitions of non-volatile types (§3.6).

  57. def isStar(x: SymbolTable.Tree): Boolean

    Is this tree a Star(_) after removing bindings?

  58. def isSuperConstrCall(tree: SymbolTable.Tree): Boolean

    Is tree a super constructor call?

  59. def isSwitchAnnotation(tpe: SymbolTable.Type): Boolean

    a Match(Typed(_, tpt), _) must be translated into a switch if isSwitchAnnotation(tpt.tpe)

  60. def isSynthCaseSymbol(sym: SymbolTable.Symbol): Boolean
  61. def isSyntheticCase(cdef: SymbolTable.CaseDef): Boolean

    Is this CaseDef synthetically generated, e.g.

    Is this CaseDef synthetically generated, e.g. by MatchTranslation.translateTry?

  62. def isSyntheticDefaultCase(cdef: SymbolTable.CaseDef): Boolean

    Is this pattern node a synthetic catch-all case, added during PartialFunction synthesis before we know whether the user provided cases are exhaustive.

  63. def isTraitRef(tree: SymbolTable.Tree): Boolean
  64. def isVarPattern(pat: SymbolTable.Tree): Boolean

    Is tree a variable pattern?

  65. def isVarPatternDeep(tree: SymbolTable.Tree): Boolean

    Does this tree represent an irrefutable pattern match in the position for { <tree> <- expr } based only on information at the parser phase? To qualify, there may be no subtree that will be interpreted as a Stable Identifier Pattern, nor any type tests, even on TupleN.

    Does this tree represent an irrefutable pattern match in the position for { <tree> <- expr } based only on information at the parser phase? To qualify, there may be no subtree that will be interpreted as a Stable Identifier Pattern, nor any type tests, even on TupleN. See scala/bug#6968.

    For instance:

    (foo @ (bar @ _)) = 0

    is a not a variable pattern; if only binds names.

    The following are not variable patterns.

    `bar`
    Bar
    (a, b)
    _: T

    If the pattern is a simple identifier, it is always a variable pattern. For example, the following introduce new bindings:

    for { X <- xs } yield X
    for { `backquoted` <- xs } yield `backquoted`

    Note that this differs from a case clause:

    object X
    scrut match {
       case X =>  // case _ if scrut == X
    }

    Background: https://groups.google.com/d/msg/scala-internals/qwa_XOw_7Ks/IktkeTBYqg0J

  66. def isVariableOrGetter(tree: SymbolTable.Tree): Boolean

    Is tree a mutable variable, or the getter of a mutable field?

  67. def isWildcardArg(tree: SymbolTable.Tree): Boolean

    Is the argument a wildcard argument of the form _ or x @ _?

  68. def isWildcardStarArg(tree: SymbolTable.Tree): Boolean

    Is this argument node of the form <expr> : _* ?

  69. def isWildcardStarArgList(trees: List[SymbolTable.Tree]): Boolean

    Does this argument list end with an argument of the form <expr> : _* ?

  70. def isWildcardStarType(tree: SymbolTable.Tree): Boolean

    Is the argument a wildcard star type of the form _*?

  71. def mapMethodParamsAndArgs[R](params: List[SymbolTable.Symbol], args: List[SymbolTable.Tree])(f: (SymbolTable.Symbol, SymbolTable.Tree) ⇒ R): List[R]
  72. def mayBeTypePat(tree: SymbolTable.Tree): Boolean

    can this type be a type pattern

  73. def mayBeVarGetter(sym: SymbolTable.Symbol): Boolean

    Is symbol potentially a getter of a variable?

  74. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  75. def noFieldFor(vd: SymbolTable.ValDef, owner: SymbolTable.Symbol): Boolean
  76. def noPredefImportForUnit(body: SymbolTable.Tree): Boolean

    Is this file the body of a compilation unit which should not have Predef imported?

  77. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  78. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  79. def preSuperFields(stats: List[SymbolTable.Tree]): List[SymbolTable.ValDef]

    The value definitions marked PRESUPER in this statement sequence

  80. def stripCast(tree: SymbolTable.Tree): SymbolTable.Tree

    Strips layers of .asInstanceOf[T] / _.$asInstanceOf[T]() from an expression

  81. def stripNamedApplyBlock(tree: SymbolTable.Tree): SymbolTable.Tree

    Named arguments can transform a constructor call into a block, e.g.

    Named arguments can transform a constructor call into a block, e.g. <init>(b = foo, a = bar) is transformed to { val x$1 = foo val x$2 = bar <init>(x$2, x$1) }

  82. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  83. def toString(): String
    Definition Classes
    AnyRef → Any
  84. def typeParameters(tree: SymbolTable.Tree): List[SymbolTable.TypeDef]

    If this tree has type parameters, those.

    If this tree has type parameters, those. Otherwise Nil.

  85. def unbind(x: SymbolTable.Tree): SymbolTable.Tree

    The underlying pattern ignoring any bindings

  86. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  87. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  88. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  89. object Applied

    Destructures applications into important subparts described in Applied class, namely into: core, targs and argss (in the specified order).

    Destructures applications into important subparts described in Applied class, namely into: core, targs and argss (in the specified order).

    Trees which are not applications are also accepted. Their callee and core will be equal to the input, while targs and argss will be Nil.

    The provided extractors don't expose all the API of the Applied class. For advanced use, call dissectApplied explicitly and use its methods instead of pattern matching.

  90. object DynamicApplication extends DynamicApplicationExtractor
  91. object DynamicApplicationNamed extends DynamicApplicationExtractor
  92. object DynamicUpdate extends DynamicApplicationExtractor
  93. object IsFalse extends SeeThroughBlocks[Boolean]
  94. object IsTrue extends SeeThroughBlocks[Boolean]
  95. object MacroImplReference
  96. object StripCast
  97. object Unapplied

    Locates the synthetic Apply node corresponding to an extractor's call to unapply (unwrapping nested Applies) and returns the fun part of that Apply.

  98. object WildcardStarArg

Inherited from AnyRef

Inherited from Any

Ungrouped