dotty.tools.dotc.ast

TreeTypeMap

Related Doc: package ast

final class TreeTypeMap extends ast.tpd.TreeMap

A map that applies three functions and a substitution together to a tree and makes sure they are coordinated so that the result is well-typed. The functions are

Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. TreeTypeMap
  2. TreeMap
  3. AnyRef
  4. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new TreeTypeMap(typeMap: (Type) ⇒ Type = IdentityTypeMap, treeMap: (tpd.Tree) ⇒ tpd.Tree = identity, oldOwners: List[Symbol] = Nil, newOwners: List[Symbol] = Nil, substFrom: List[Symbol] = Nil, substTo: List[Symbol] = Nil)(implicit ctx: Context)

    typeMap

    A function from Type to Type that gets applied to the type of every tree node and to all locally defined symbols, followed by the substitution [substFrom := substTo].

    treeMap

    A transformer that translates all encountered subtrees in prefix traversal orders

    oldOwners

    Previous owners. If a top-level local symbol in the mapped tree has one of these as an owner, the owner is replaced by the corresponding symbol in newOwners.

    newOwners

    New owners, replacing previous owners.

    substFrom

    The symbols that need to be substituted.

    substTo

    The substitution targets.

    The reason the substitution is broken out from the rest of the type map is that all symbols have to be substituted at the same time. If we do not do this, we risk data races on named types. Example: Say we have outer#1.inner#2 and we have two substitutions S1 = [outer#1 := outer#3], S2 = [inner#2 := inner#4] where hashtags precede symbol ids. If we do S1 first, we get outer#2.inner#3. If we then do S2 we get outer#2.inner#4. But that means that the named type outer#2.inner gets two different denotations in the same period. Hence, if -Yno-double-bindings is set, we would get a data race assertion error.

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. def apply(annot: Annotation): Annotation

  5. def apply[ThisTree <: tpd.Tree](tree: ThisTree): ThisTree

  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. val cpy: tpd.TreeCopier

    Definition Classes
    TreeMap
  9. final def eq(arg0: AnyRef): Boolean

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

    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  13. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  14. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  15. def mapOwner(sym: Symbol): Symbol

    If sym is one of oldOwners, replace by corresponding symbol in newOwners

  16. def mapType(tp: Type): Type

  17. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  18. val newOwners: List[Symbol]

    New owners, replacing previous owners.

  19. final def notify(): Unit

    Definition Classes
    AnyRef
  20. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  21. val oldOwners: List[Symbol]

    Previous owners.

    Previous owners. If a top-level local symbol in the mapped tree has one of these as an owner, the owner is replaced by the corresponding symbol in newOwners.

  22. val substFrom: List[Symbol]

    The symbols that need to be substituted.

  23. val substTo: List[Symbol]

    The substitution targets.

    The substitution targets.

    The reason the substitution is broken out from the rest of the type map is that all symbols have to be substituted at the same time. If we do not do this, we risk data races on named types. Example: Say we have outer#1.inner#2 and we have two substitutions S1 = [outer#1 := outer#3], S2 = [inner#2 := inner#4] where hashtags precede symbol ids. If we do S1 first, we get outer#2.inner#3. If we then do S2 we get outer#2.inner#4. But that means that the named type outer#2.inner gets two different denotations in the same period. Hence, if -Yno-double-bindings is set, we would get a data race assertion error.

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

    Definition Classes
    AnyRef
  25. def toString(): String

    Definition Classes
    AnyRef → Any
  26. def transform(tree: tpd.Tree)(implicit ctx: Context): tpd.Tree

    Definition Classes
    TreeTypeMapTreeMap
  27. def transform(trees: List[tpd.Tree])(implicit ctx: Context): List[tpd.Tree]

    Definition Classes
    TreeMap
  28. def transformStats(trees: List[tpd.Tree])(implicit ctx: Context): List[tpd.Tree]

    Definition Classes
    TreeTypeMapTreeMap
  29. def transformSub[Tr <: tpd.Tree](trees: List[Tr])(implicit ctx: Context): List[Tr]

    Definition Classes
    TreeMap
  30. def transformSub[Tr <: tpd.Tree](tree: Tr)(implicit ctx: Context): Tr

    Definition Classes
    TreeMap
  31. val treeMap: (tpd.Tree) ⇒ tpd.Tree

    A transformer that translates all encountered subtrees in prefix traversal orders

  32. val typeMap: (Type) ⇒ Type

    A function from Type to Type that gets applied to the type of every tree node and to all locally defined symbols, followed by the substitution [substFrom := substTo].

  33. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. def withMappedSyms(syms: List[Symbol], mapped: List[Symbol]): TreeTypeMap

    The tree map with the substitution between originals syms and mapped symbols mapped.

    The tree map with the substitution between originals syms and mapped symbols mapped. Also goes into mapped classes and substitutes their declarations.

  37. def withMappedSyms(syms: List[Symbol], mapAlways: Boolean = false): TreeTypeMap

    Apply typeMap and ownerMap to given symbols syms and return a treemap that contains the substitution between original and mapped symbols.

  38. def withSubstitution(from: List[Symbol], to: List[Symbol]): TreeTypeMap

    The current tree map composed with a substitution [from -> to]

Inherited from tpd.TreeMap

Inherited from AnyRef

Inherited from Any

Ungrouped