scala.reflect.api

# Trees

#### trait Trees extends AnyRef

Self Type
  Universe
Source
  Trees.scala

Linear Supertypes
AnyRef, Any
Known Subclasses
Context, Mirror, TreeBuildUtil, Universe
Ordering

1. Alphabetic
2. By inheritance

Inherited

1. Hide All
2. Show all

1. Trees
2. AnyRef
3. Any

Visibility

1. Public
2. All

### Type Members

1. #### abstract class AbsModifiers extends AnyRef

2. #### case class Alternative(trees: List[Tree]) extends Tree with TermTree with Product with Serializable

   Alternatives of patterns, eliminated by explicitouter, except for occurrences in encoded Switch stmt (=remaining Match(CaseDef(.

3. #### case class Annotated(annot: Tree, arg: Tree) extends Tree with Product with Serializable

   A tree that has an annotation attached to it.

4. #### case class AppliedTypeTree(tpt: Tree, args: List[Tree]) extends Tree with TypTree with Product with Serializable

   Applied type <tpt> [ <args> ], eliminated by RefCheck

5. #### case class Apply(fun: Tree, args: List[Tree]) extends GenericApply with Product with Serializable

   Value application

6. #### case class ApplyDynamic(qual: Tree, args: List[Tree]) extends Tree with TermTree with SymTree with Product with Serializable

   Dynamic value application.

7. #### class ApplyImplicitView extends Apply

8. #### class ApplyToImplicitArgs extends Apply

9. #### case class ArrayValue(elemtpt: Tree, elems: List[Tree]) extends Tree with TermTree with Product with Serializable

   Array of expressions, needs to be translated in backend,

10. #### case class Assign(lhs: Tree, rhs: Tree) extends Tree with TermTree with Product with Serializable

    Assignment

11. #### case class AssignOrNamedArg(lhs: Tree, rhs: Tree) extends Tree with TermTree with Product with Serializable

    Either an assignment or a named argument.

12. #### class BackQuotedIdent extends Ident

13. #### case class Bind(name: Name, body: Tree) extends DefTree with Product with Serializable

    Bind of a variable to a rhs pattern, eliminated by explicitouter

14. #### case class Block(stats: List[Tree], expr: Tree) extends Tree with TermTree with Product with Serializable

    Block of expressions (semicolon separated expressions)

15. #### case class CaseDef(pat: Tree, guard: Tree, body: Tree) extends Tree with Product with Serializable

    Case clause in a pattern match, eliminated during explicitouter (except for occurrences in switch statements)

16. #### case class ClassDef(mods: Modifiers, name: TypeName, tparams: List[TypeDef], impl: Template) extends ImplDef with Product with Serializable

    A class definition.

17. #### case class CompoundTypeTree(templ: Template) extends Tree with TypTree with Product with Serializable

    Intersection type <parent1> with .

18. #### case class DefDef(mods: Modifiers, name: Name, tparams: List[TypeDef], vparamss: List[List[ValDef]], tpt: Tree, rhs: Tree) extends ValOrDefDef with Product with Serializable

    A method or macro definition.

19. #### abstract class DefTree extends Tree with SymTree

    A tree which defines a symbol-carrying entity.

20. #### case class ExistentialTypeTree(tpt: Tree, whereClauses: List[Tree]) extends Tree with TypTree with Product with Serializable

21. #### class FilterTreeTraverser extends Traverser

22. #### class FindTreeTraverser extends Traverser

23. #### class ForeachTreeTraverser extends Traverser

24. #### case class Function(vparams: List[ValDef], body: Tree) extends Tree with TermTree with SymTree with Product with Serializable

    Anonymous function, eliminated by analyzer

25. #### abstract class GenericApply extends Tree with TermTree

    Common base class for Apply and TypeApply.

26. #### case class Ident(name: Name) extends Tree with RefTree with Product with Serializable

    Identifier <name>

27. #### case class If(cond: Tree, thenp: Tree, elsep: Tree) extends Tree with TermTree with Product with Serializable

    Conditional expression

28. #### abstract class ImplDef extends MemberDef

    A common base class for class and object definitions.

29. #### case class Import(expr: Tree, selectors: List[ImportSelector]) extends Tree with SymTree with Product with Serializable

    Import clause

30. #### case class ImportSelector(name: Name, namePos: Int, rename: Name, renamePos: Int) extends Product with Serializable

    Import selector

31. #### case class LabelDef(name: TermName, params: List[Ident], rhs: Tree) extends DefTree with TermTree with Product with Serializable

    A labelled expression.

32. #### class LazyTreeCopier extends TreeCopierOps

33. #### case class Literal(value: Constant) extends Tree with TermTree with Product with Serializable

    Literal

34. #### case class Match(selector: Tree, cases: List[CaseDef]) extends Tree with TermTree with Product with Serializable

    - Pattern matching expression (before explicitouter)

35. #### abstract class MemberDef extends DefTree

    Common base class for all member definitions: types, classes, objects, packages, vals and vars, defs.

36. #### abstract type Modifiers <: AbsModifiers

37. #### case class ModuleDef(mods: Modifiers, name: TermName, impl: Template) extends ImplDef with Product with Serializable

    An object definition, e.

38. #### case class New(tpt: Tree) extends Tree with TermTree with Product with Serializable

    Object instantiation One should always use factory method below to build a user level new.

39. #### case class PackageDef(pid: RefTree, stats: List[Tree]) extends MemberDef with Product with Serializable

    A packaging, such as `package pid { stats }`

40. #### trait RefTree extends Tree with SymTree

    A tree which references a symbol-carrying entity.

41. #### case class Return(expr: Tree) extends Tree with TermTree with SymTree with Product with Serializable

    Return expression

42. #### case class Select(qualifier: Tree, name: Name) extends Tree with RefTree with Product with Serializable

    Designator <qualifier> .

43. #### case class SelectFromTypeTree(qualifier: Tree, name: TypeName) extends Tree with TypTree with RefTree with Product with Serializable

    Type selection <qualifier> # <name>, eliminated by RefCheck

44. #### case class SingletonTypeTree(ref: Tree) extends Tree with TypTree with Product with Serializable

    Singleton type, eliminated by RefCheck

45. #### case class Star(elem: Tree) extends Tree with TermTree with Product with Serializable

    Repetition of pattern, eliminated by explicitouter

46. #### class StrictTreeCopier extends TreeCopierOps

47. #### case class Super(qual: Tree, mix: TypeName) extends Tree with TermTree with Product with Serializable

    Super reference, qual = corresponding this reference

48. #### trait SymTree extends Tree

    A tree with a mutable symbol field, initialized to NoSymbol.

49. #### case class Template(parents: List[Tree], self: ValDef, body: List[Tree]) extends Tree with SymTree with Product with Serializable

    Instantiation template of a class or trait

50. #### trait TermTree extends Tree

    A tree for a term.

51. #### case class This(qual: TypeName) extends Tree with TermTree with SymTree with Product with Serializable

    Self reference

52. #### case class Throw(expr: Tree) extends Tree with TermTree with Product with Serializable

    Throw expression

53. #### abstract class Transformer extends AnyRef

54. #### class Traverser extends AnyRef

55. #### abstract class Tree extends Product

    Tree is the basis for scala's abstract syntax.

56. #### abstract type TreeCopier <: TreeCopierOps

57. #### trait TreeCopierOps extends AnyRef

58. #### case class Try(block: Tree, catches: List[CaseDef], finalizer: Tree) extends Tree with TermTree with Product with Serializable

59. #### trait TypTree extends Tree

    A tree for a type.

60. #### case class TypeApply(fun: Tree, args: List[Tree]) extends GenericApply with Product with Serializable

    Explicit type application.

61. #### case class TypeBoundsTree(lo: Tree, hi: Tree) extends Tree with TypTree with Product with Serializable

62. #### case class TypeDef(mods: Modifiers, name: TypeName, tparams: List[TypeDef], rhs: Tree) extends MemberDef with Product with Serializable

    An abstract type, a type parameter, or a type alias.

63. #### case class TypeTree() extends Tree with TypTree with Product with Serializable

    A synthetic tree holding an arbitrary type.

64. #### case class Typed(expr: Tree, tpt: Tree) extends Tree with TermTree with Product with Serializable

    Type annotation, eliminated by explicit outer

65. #### case class UnApply(fun: Tree, args: List[Tree]) extends Tree with TermTree with Product with Serializable

66. #### case class ValDef(mods: Modifiers, name: TermName, tpt: Tree, rhs: Tree) extends ValOrDefDef with Product with Serializable

    A value definition (this includes vars as well, which differ from vals only in having the MUTABLE flag set in their Modifiers.

67. #### abstract class ValOrDefDef extends MemberDef

    A common base class for ValDefs and DefDefs.

### Abstract Value Members

1. #### abstract def Modifiers(mods: Set[Modifier] = Set(), privateWithin: Name = EmptyTypeName, annotations: List[Tree] = List()): Modifiers

2. #### abstract def duplicateTree(tree: Tree): Tree

   Attributes
     protected

3. #### abstract def emptyValDef: ValDef

   An empty deferred value definition corresponding to: val _: _ This is used as a placeholder in the `self` parameter Template if there is no definition of a self value of self type.

4. #### abstract def newLazyTreeCopier: TreeCopier

5. #### abstract def newStrictTreeCopier: TreeCopier

### Concrete Value Members

1. #### final def !=(arg0: AnyRef): Boolean

   Definition Classes
     AnyRef

2. #### final def !=(arg0: Any): Boolean

   Test two objects for inequality.

   Test two objects for inequality.

   returns

     `true` if !(this == that), false otherwise.

   Definition Classes
     Any

3. #### final def ##(): Int

   Equivalent to `x.hashCode` except for boxed numeric types and `null`.

   Equivalent to `x.hashCode` except for boxed numeric types and `null`. For numerics, it returns a hash value which is consistent with value equality: if two value type instances compare as true, then ## will produce the same hash value for each of them. For `null` returns a hashcode where `null.hashCode` throws a `NullPointerException`.

   returns

     a hash value consistent with ==

   Definition Classes
     AnyRef → Any

4. #### final def ==(arg0: AnyRef): Boolean

   Definition Classes
     AnyRef

5. #### final def ==(arg0: Any): Boolean

   Test two objects for equality.

   Test two objects for equality. The expression `x == that` is equivalent to `if (x eq null) that eq null else x.equals(that)`.

   returns

     `true` if the receiver object is equivalent to the argument; `false` otherwise.

   Definition Classes
     Any

6. #### object EmptyTree extends Tree with TermTree with Product with Serializable

   The empty tree

7. #### def Ident(sym: Symbol): Ident

8. #### def Ident(name: String): Ident

9. #### def New(tpt: Tree, argss: List[List[Tree]]): Tree

   Factory method for object creation `new tpt(args_1)...(args_n)` A `New(t, as)` is expanded to: `(new t).<init>(as)`

10. #### def Select(qualifier: Tree, sym: Symbol): Select

11. #### def Select(qualifier: Tree, name: String): Select

12. #### def This(sym: Symbol): Tree

13. #### def TypeTree(tp: Type): TypeTree

14. #### final def asInstanceOf[T0]: T0

    Cast the receiver object to be of type `T0`.

    Cast the receiver object to be of type `T0`.

    Note that the success of a cast at runtime is modulo Scala's erasure semantics. Therefore the expression `1.asInstanceOf[String]` will throw a `ClassCastException` at runtime, while the expression `List(1).asInstanceOf[List[String]]` will not. In the latter example, because the type argument is erased as part of compilation it is not possible to check whether the contents of the list are of the requested type.

    returns

      the receiver object.

    Definition Classes
      Any
    Exceptions thrown
      ClassCastException

      if the receiver object is not an instance of the erasure of type `T0`.

15. #### def clone(): AnyRef

    Create a copy of the receiver object.

    Create a copy of the receiver object.

    The default implementation of the `clone` method is platform dependent.

    returns

      a copy of the receiver object.

    Attributes
      protected[lang]
    Definition Classes
      AnyRef
    Annotations
      @throws()
    Note

      not specified by SLS as a member of AnyRef

16. #### final def eq(arg0: AnyRef): Boolean

    Tests whether the argument (`arg0`) is a reference to the receiver object (`this`).

    Tests whether the argument (`arg0`) is a reference to the receiver object (`this`).

    The `eq` method implements an equivalence relation on non-null instances of `AnyRef`, and has three additional properties:

    - It is consistent: for any non-null instances `x` and `y` of type `AnyRef`, multiple invocations of `x.eq(y)` consistently returns `true` or consistently returns `false`.
    - For any non-null instance `x` of type `AnyRef`, `x.eq(null)` and `null.eq(x)` returns `false`.
    - `null.eq(null)` returns `true`.

    When overriding the `equals` or `hashCode` methods, it is important to ensure that their behavior is consistent with reference equality. Therefore, if two objects are references to each other (`o1 eq o2`), they should be equal to each other (`o1 == o2`) and they should hash to the same value (`o1.hashCode == o2.hashCode`).

    returns

      `true` if the argument is a reference to the receiver object; `false` otherwise.

    Definition Classes
      AnyRef

17. #### def equals(arg0: Any): Boolean

    The equality method for reference types.

    The equality method for reference types. Default implementation delegates to `eq`.

    See also `equals` in Any.

    returns

      `true` if the receiver object is equivalent to the argument; `false` otherwise.

    Definition Classes
      AnyRef → Any

18. #### def finalize(): Unit

    Called by the garbage collector on the receiver object when there are no more references to the object.

    Called by the garbage collector on the receiver object when there are no more references to the object.

    The details of when and if the `finalize` method is invoked, as well as the interaction between `finalize` and non-local returns and exceptions, are all platform dependent.

    Attributes
      protected[lang]
    Definition Classes
      AnyRef
    Annotations
      @throws()
    Note

      not specified by SLS as a member of AnyRef

19. #### final def getClass(): Class[_]

    A representation that corresponds to the dynamic class of the receiver object.

    A representation that corresponds to the dynamic class of the receiver object.

    The nature of the representation is platform dependent.

    returns

      a representation that corresponds to the dynamic class of the receiver object.

    Definition Classes
      AnyRef → Any
    Note

      not specified by SLS as a member of AnyRef

20. #### def hashCode(): Int

    The hashCode method for reference types.

    The hashCode method for reference types. See hashCode in Any.

    returns

      the hash code value for this object.

    Definition Classes
      AnyRef → Any

21. #### final def isInstanceOf[T0]: Boolean

    Test whether the dynamic type of the receiver object is `T0`.

    Test whether the dynamic type of the receiver object is `T0`.

    Note that the result of the test is modulo Scala's erasure semantics. Therefore the expression `1.isInstanceOf[String]` will return `false`, while the expression `List(1).isInstanceOf[List[String]]` will return `true`. In the latter example, because the type argument is erased as part of compilation it is not possible to check whether the contents of the list are of the specified type.

    returns

      `true` if the receiver object is an instance of erasure of type `T0`; `false` otherwise.

    Definition Classes
      Any

22. #### final def ne(arg0: AnyRef): Boolean

    Equivalent to `!(this eq that)`.

    Equivalent to `!(this eq that)`.

    returns

      `true` if the argument is not a reference to the receiver object; `false` otherwise.

    Definition Classes
      AnyRef

23. #### final def notify(): Unit

    Wakes up a single thread that is waiting on the receiver object's monitor.

    Wakes up a single thread that is waiting on the receiver object's monitor.

    Definition Classes
      AnyRef
    Note

      not specified by SLS as a member of AnyRef

24. #### final def notifyAll(): Unit

    Wakes up all threads that are waiting on the receiver object's monitor.

    Wakes up all threads that are waiting on the receiver object's monitor.

    Definition Classes
      AnyRef
    Note

      not specified by SLS as a member of AnyRef

25. #### final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
      AnyRef

26. #### def toString(): String

    Creates a String representation of this object.

    Creates a String representation of this object. The default representation is platform dependent. On the java platform it is the concatenation of the class name, "@", and the object's hashcode in hexadecimal.

    returns

      a String representation of the object.

    Definition Classes
      AnyRef → Any

27. #### val treeCopy: TreeCopier

28. #### final def wait(): Unit

    Definition Classes
      AnyRef
    Annotations
      @throws()

29. #### final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
      AnyRef
    Annotations
      @throws()

30. #### final def wait(arg0: Long): Unit

    Definition Classes
      AnyRef
    Annotations
      @throws()

31. #### def xtransform(transformer: Transformer, tree: Tree): Tree

    Attributes
      protected

32. #### def xtraverse(traverser: Traverser, tree: Tree): Unit

    Attributes
      protected

### Inherited from AnyRef

### Inherited from Any