abstract class TreeGen extends AnyRef

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

Instance Constructors

  1. new TreeGen()

Type Members

  1. class GetVarTraverser extends SymbolTable.Traverser

    Traverse pattern and collect all variable names with their types in buffer The variables keep their positions; whereas the pattern is converted to be synthetic for all nodes that contain a variable position.

  2. class PatvarTransformer extends SymbolTable.Transformer

    Convert all occurrences of (lower-case) variables in a pattern as follows: x becomes x @ _ x: T becomes x @ (_: T)

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 def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  12. def isPatVarWarnable: Boolean

    Can be overridden to depend on settings.warnUnusedPatvars.

  13. def maybeMkAsInstanceOf(tree: SymbolTable.Tree, pt: SymbolTable.Type, tpe: SymbolTable.Type, beforeRefChecks: Boolean = false): SymbolTable.Tree

    Cast tree to pt, unless tpe is a subtype of pt, or pt is Unit.

  14. def mkAnd(tree1: SymbolTable.Tree, tree2: SymbolTable.Tree): SymbolTable.Tree
  15. def mkAppliedTypeTree(fun: SymbolTable.Tree, targs: List[SymbolTable.Tree]): SymbolTable.Tree
  16. def mkApplyIfNeeded(qual: SymbolTable.Tree): SymbolTable.Tree

    If this is a reference to a method with an empty parameter list, wrap it in an apply.

  17. def mkAsInstanceOf(value: SymbolTable.Tree, tpe: SymbolTable.Type, any: Boolean = true, wrapInApply: Boolean = true): SymbolTable.Tree

    Builds a cast with given value and type.

  18. def mkAssign(lhs: SymbolTable.Tree, rhs: SymbolTable.Tree): SymbolTable.Tree

    Create a tree representing an assignment <lhs = rhs>

  19. def mkAttributedIdent(sym: SymbolTable.Symbol): SymbolTable.RefTree
  20. def mkAttributedQualifier(tpe: SymbolTable.Type, termSym: SymbolTable.Symbol): SymbolTable.Tree

    Builds a reference to value whose type is given stable prefix.

    Builds a reference to value whose type is given stable prefix. If the type is unsuitable, e.g. it is a TypeRef for an abstract type variable, then an Ident will be made using termSym as the Ident's symbol. In that case, termSym must not be NoSymbol.

  21. def mkAttributedQualifier(tpe: SymbolTable.Type): SymbolTable.Tree

    Builds a reference to value whose type is given stable prefix.

    Builds a reference to value whose type is given stable prefix. The type must be suitable for this. For example, it must not be a TypeRef pointing to an abstract type variable.

  22. def mkAttributedQualifierIfPossible(prefix: SymbolTable.Type): Option[SymbolTable.Tree]
  23. def mkAttributedRef(sym: SymbolTable.Symbol): SymbolTable.RefTree

    Builds a reference to given symbol.

  24. def mkAttributedRef(pre: SymbolTable.Type, sym: SymbolTable.Symbol): SymbolTable.RefTree

    Builds a reference to given symbol with given stable prefix.

  25. def mkAttributedSelect(qual: SymbolTable.Tree, sym: SymbolTable.Symbol): SymbolTable.RefTree
  26. def mkAttributedStableRef(sym: SymbolTable.Symbol): SymbolTable.Tree
  27. def mkAttributedStableRef(pre: SymbolTable.Type, sym: SymbolTable.Symbol): SymbolTable.Tree

    Builds a reference with stable type to given symbol

  28. def mkAttributedThis(sym: SymbolTable.Symbol): SymbolTable.This
  29. def mkAttributedTypeApply(target: SymbolTable.Tree, method: SymbolTable.Symbol, targs: List[SymbolTable.Type]): SymbolTable.Tree
  30. def mkBlock(stats: List[SymbolTable.Tree], doFlatten: Boolean = true): SymbolTable.Tree

    Create block of statements stats

  31. def mkCast(tree: SymbolTable.Tree, pt: SymbolTable.Type): SymbolTable.Tree
  32. def mkCheckIfRefutable(pat: SymbolTable.Tree, rhs: SymbolTable.Tree)(implicit fresh: FreshNameCreator): SymbolTable.Tree
  33. def mkClassDef(mods: SymbolTable.Modifiers, name: SymbolTable.TypeName, tparams: List[SymbolTable.TypeDef], templ: SymbolTable.Template): SymbolTable.ClassDef
  34. def mkClassOf(tp: SymbolTable.Type): SymbolTable.Tree

    Apparently we smuggle a Type around as a Literal(Constant(tp)) and the implementation of Constant#tpe is such that x.tpe becomes ClassType(value.asInstanceOf[Type]), i.e.

    Apparently we smuggle a Type around as a Literal(Constant(tp)) and the implementation of Constant#tpe is such that x.tpe becomes ClassType(value.asInstanceOf[Type]), i.e. java.lang.Class[Type]. Can't find any docs on how/why it's done this way. See ticket scala/bug#490 for some interesting comments from lauri alanko suggesting that the type given by classOf[T] is too strong and should be weakened so as not to suggest that classOf[List[String]] is any different from classOf[List[Int]].

    !!! See deconstMap in Erasure for one bug this encoding has induced: I would be very surprised if there aren't more.

  35. def mkConstantZero(tp: SymbolTable.Type): SymbolTable.Constant
  36. def mkFor(enums: List[SymbolTable.Tree], sugarBody: SymbolTable.Tree)(implicit fresh: FreshNameCreator): SymbolTable.Tree

    Create tree for for-comprehension <for (enums) do body> or <for (enums) yield body> where mapName and flatMapName are chosen corresponding to whether this is a for-do or a for-yield.

    Create tree for for-comprehension <for (enums) do body> or <for (enums) yield body> where mapName and flatMapName are chosen corresponding to whether this is a for-do or a for-yield. The creation performs the following rewrite rules:

    1.

    for (P <- G) E ==> G.foreach (P => E)

    Here and in the following (P => E) is interpreted as the function (P => E) if P is a variable pattern and as the partial function { case P => E } otherwise.

    2.

    for (P <- G) yield E ==> G.map (P => E)

    3.

    for (P_1 <- G_1; P_2 <- G_2; ...) ...

    > G_1.flatMap (P_1 => for (P_2 <- G_2; ...) ...)

    4.

    for (P <- G; E; ...) ...

    > for (P <- G.filter (P

    5. For N < MaxTupleArity:

    for (P_1 <- G; P_2 = E_2; val P_N = E_N; ...)

    > for (TupleN(P_1, P_2, ... P_N) <- for (x_1 @ P_1 <- G) yield { val x_2 @ P_2 = E_2 ... val x_N & P_N = E_N TupleN(x_1, ..., x_N) } ...)

    If any of the P_i are variable patterns, the corresponding x_i @ P_i is not generated and the variable constituting P_i is used instead of x_i

    enums

    The enumerators in the for expression

    sugarBody

    The body of the for expression

    fresh

    A source of new names

  37. def mkFunctionTypeTree(argtpes: List[SymbolTable.Tree], restpe: SymbolTable.Tree): SymbolTable.Tree

    Create a tree representing the function type (argtpes) => restpe

  38. def mkGenerator(pos: SymbolTable.Position, pat: SymbolTable.Tree, valeq: Boolean, rhs: SymbolTable.Tree)(implicit fresh: FreshNameCreator): SymbolTable.Tree

    Create tree for for-comprehension generator <val pat0 <- rhs0>

  39. def mkIsInstanceOf(value: SymbolTable.Tree, tpe: SymbolTable.Type, any: Boolean = true, wrapInApply: Boolean = true): SymbolTable.Tree

    Builds an instance test with given value and type.

  40. def mkLiteralUnit: SymbolTable.Literal
  41. def mkMethodCall(target: SymbolTable.Tree, targs: List[SymbolTable.Type], args: List[SymbolTable.Tree]): SymbolTable.Tree
  42. def mkMethodCall(receiver: SymbolTable.Tree, method: SymbolTable.Symbol, targs: List[SymbolTable.Type], args: List[SymbolTable.Tree]): SymbolTable.Tree
  43. def mkMethodCall(receiver: SymbolTable.Symbol, methodName: SymbolTable.Name, args: List[SymbolTable.Tree]): SymbolTable.Tree
  44. def mkMethodCall(target: SymbolTable.Tree, args: List[SymbolTable.Tree]): SymbolTable.Tree
  45. def mkMethodCall(method: SymbolTable.Symbol, args: List[SymbolTable.Tree]): SymbolTable.Tree
  46. def mkMethodCall(method: SymbolTable.Symbol, targs: List[SymbolTable.Type], args: List[SymbolTable.Tree]): SymbolTable.Tree
  47. def mkMethodCall(receiver: SymbolTable.Symbol, methodName: SymbolTable.Name, targs: List[SymbolTable.Type], args: List[SymbolTable.Tree]): SymbolTable.Tree

    A creator for method calls, e.g.

    A creator for method calls, e.g. fn[T1, T2, ...](v1, v2, ...) There are a number of variations.

    receiver

    symbol of the method receiver

    methodName

    name of the method to call

    targs

    type arguments (if Nil, no TypeApply node will be generated)

    args

    value arguments

    returns

    the newly created trees.

  48. def mkNamedArg(lhs: SymbolTable.Tree, rhs: SymbolTable.Tree): SymbolTable.Tree
  49. def mkNamedArg(name: SymbolTable.Name, tree: SymbolTable.Tree): SymbolTable.Tree

    Wrap an expression in a named argument.

  50. def mkNew(parents: List[SymbolTable.Tree], self: SymbolTable.ValDef, stats: List[SymbolTable.Tree], npos: SymbolTable.Position, cpos: SymbolTable.Position): SymbolTable.Tree

    Create positioned tree representing an object creation <new parents { stats }

    Create positioned tree representing an object creation <new parents { stats }

    npos

    the position of the new

    cpos

    the position of the anonymous class starting with parents

  51. def mkNil: SymbolTable.Tree

    Builds a list with given head and tail.

  52. def mkNullaryCall(method: SymbolTable.Symbol, targs: List[SymbolTable.Type]): SymbolTable.Tree
  53. def mkOr(tree1: SymbolTable.Tree, tree2: SymbolTable.Tree): SymbolTable.Tree
  54. def mkPackageObject(defn: SymbolTable.ModuleDef, pidPos: SymbolTable.Position = NoPosition, pkgPos: SymbolTable.Position = NoPosition): SymbolTable.PackageDef
  55. def mkParents(ownerMods: SymbolTable.Modifiers, parents: List[SymbolTable.Tree], parentPos: SymbolTable.Position = NoPosition): collection.immutable.List[SymbolTable.Tree]
  56. def mkPatDef(mods: SymbolTable.Modifiers, pat: SymbolTable.Tree, rhs: SymbolTable.Tree)(implicit fresh: FreshNameCreator): List[SymbolTable.ValDef]

    Create tree for pattern definition <mods val pat0 = rhs>

  57. def mkPatDef(pat: SymbolTable.Tree, rhs: SymbolTable.Tree)(implicit fresh: FreshNameCreator): List[SymbolTable.ValDef]

    Create tree for pattern definition <val pat0 = rhs>

  58. def mkRuntimeUniverseRef: SymbolTable.Tree
  59. def mkSeqApply(arg: SymbolTable.Tree): SymbolTable.Apply
  60. def mkSuperInitCall: SymbolTable.Select
  61. def mkSyntheticParam(pname: SymbolTable.TermName): SymbolTable.ValDef
  62. def mkSyntheticUnit(): SymbolTable.Literal

    Create a literal unit tree that is inserted by the compiler but not written by end user.

    Create a literal unit tree that is inserted by the compiler but not written by end user. It's important to distinguish the two so that quasiquotes can strip synthetic ones away.

  63. def mkTemplate(parents: List[SymbolTable.Tree], self: SymbolTable.ValDef, constrMods: SymbolTable.Modifiers, vparamss: List[List[SymbolTable.ValDef]], body: List[SymbolTable.Tree], superPos: SymbolTable.Position = NoPosition): SymbolTable.Template

    Generates a template with constructor corresponding to

    Generates a template with constructor corresponding to

    constrmods (vparams1_) ... (vparams_n) preSuper { presupers } extends superclass(args_1) ... (args_n) with mixins { self => body }

    This gets translated to

    extends superclass with mixins { self => presupers' // presupers without rhs vparamss // abstract fields corresponding to value parameters def <init>(vparamss) { presupers super.<init>(args) } body }

  64. def mkTreeOrBlock(stats: List[SymbolTable.Tree]): SymbolTable.Tree

    Create a block that wraps multiple statements but don't do any wrapping if there is just one statement.

    Create a block that wraps multiple statements but don't do any wrapping if there is just one statement. Used by quasiquotes, macro c.parse api and toolbox.

  65. def mkTuple(elems: List[SymbolTable.Tree], flattenUnary: Boolean = true): SymbolTable.Tree

    Builds a tuple

  66. def mkTupleType(elems: List[SymbolTable.Tree], flattenUnary: Boolean = true): SymbolTable.Tree
  67. def mkTypeApply(fun: SymbolTable.Tree, targs: List[SymbolTable.Tree]): SymbolTable.Tree

    Builds a type application node if args.nonEmpty, returns fun otherwise.

  68. def mkUnattributedRef(fullName: SymbolTable.Name): SymbolTable.RefTree
  69. def mkUnattributedRef(sym: SymbolTable.Symbol): SymbolTable.RefTree
  70. def mkUnchecked(expr: SymbolTable.Tree): SymbolTable.Tree
  71. def mkUnitBlock(expr: SymbolTable.Tree): SymbolTable.Block
  72. def mkVisitor(cases: List[SymbolTable.CaseDef], checkExhaustive: Boolean, prefix: String = "x$")(implicit fresh: FreshNameCreator): SymbolTable.Tree

    Create visitor <x => x match cases>

  73. def mkZero(tp: SymbolTable.Type): SymbolTable.Tree

    Builds a tree representing an undefined local, as in var x: T = _ which is appropriate to the given Type.

  74. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  75. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  76. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  77. def rootId(name: SymbolTable.Name): SymbolTable.Select
  78. def rootScalaDot(name: SymbolTable.Name): SymbolTable.Select
  79. def scalaAnnotationDot(name: SymbolTable.Name): SymbolTable.Select
  80. def scalaAnyRefConstr: SymbolTable.Select
  81. def scalaDot(name: SymbolTable.Name): SymbolTable.Select
  82. def scalaFunctionConstr(argtpes: List[SymbolTable.Tree], restpe: SymbolTable.Tree, abstractFun: Boolean = false): SymbolTable.Tree
  83. def stabilize(tree: SymbolTable.Tree): SymbolTable.Tree

    Replaces tree type with a stable type if possible

  84. def stableTypeFor(tree: SymbolTable.Tree): SymbolTable.Type

    Computes stable type for a tree if possible

  85. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  86. def toString(): String
    Definition Classes
    AnyRef → Any
  87. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  88. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  89. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  90. object Filter

    Encode/decode fq"if $cond" enumerator as q"if($cond)"

  91. object ValEq

    Encode/decode fq"$pat = $rhs" enumerator as q"$pat = $rhs"

  92. object ValFrom

    Encode/decode fq"$pat <- $rhs" enumerator as q"<-($pat, $rhs)"

  93. object Yield

    Encode/decode body of for yield loop as q"yield($tree)"

  94. object patvarTransformer extends PatvarTransformer

    Not in for comprehensions, whether to warn unused pat vars depends on flag.

  95. object patvarTransformerForFor extends PatvarTransformer

    Tag pat vars in for comprehensions.

Inherited from AnyRef

Inherited from Any

Ungrouped