Trait

inox.ast

GenTreeOps

Related Doc: package ast

Permalink

trait GenTreeOps extends AnyRef

Generic tree traversals based on a deconstructor of a specific tree type

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

Type Members

  1. abstract type Source <: Tree

    Permalink
  2. abstract type Target <: Tree

    Permalink

Abstract Value Members

  1. abstract val Deconstructor: TreeExtractor { ... /* 4 definitions in type refinement */ }

    Permalink

    An extractor for Source

  2. abstract val sourceTrees: Trees

    Permalink
    Attributes
    protected
  3. abstract val targetTrees: Trees

    Permalink
    Attributes
    protected

Concrete 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 Same

    Permalink
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def collect[T](matcher: (Source) ⇒ Set[T])(e: Source): Set[T]

    Permalink

    Collects a set of objects from all sub-expressions

  8. def collectPreorder[T](matcher: (Source) ⇒ Seq[T])(e: Source): Seq[T]

    Permalink
  9. def count(matcher: (Source) ⇒ Int)(e: Source): Int

    Permalink

    Counts how many times the predicate holds in sub-expressions

  10. def depth(e: Source): Int

    Permalink

    Computes the depth of the tree

  11. final def eq(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  13. def exists(matcher: (Source) ⇒ Boolean)(e: Source): Boolean

    Permalink

    Checks if the predicate holds in some sub-expression

  14. def filter(matcher: (Source) ⇒ Boolean)(e: Source): Set[Source]

    Permalink

    Returns a set of all sub-expressions matching the predicate

  15. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  16. def fold[T](f: (Source, Seq[T]) ⇒ T)(e: Source): T

    Permalink

    Does a right tree fold

    Does a right tree fold

    A right tree fold applies the input function to the subnodes first (from left to right), and combine the results along with the current node value.

    f

    a function that takes the current node and the seq of results form the Sources.

    e

    The value on which to apply the fold.

    returns

    The expression after applying f on all Sources.

    Note

    the computation is lazy, hence you should not rely on side-effects of f

  17. def formulaSize(t: Source): Int

    Permalink

    Computes the size of a tree

  18. def genericTransform[C](pre: (Source, C) ⇒ (Source, C), post: (Target, C) ⇒ (Target, C), combiner: (Target, Seq[C]) ⇒ C)(init: C)(expr: Source): (Target, C)

    Permalink

    Applies functions and combines results in a generic way

    Applies functions and combines results in a generic way

    Start with an initial value, and apply functions to nodes before and after the recursion in the children. Combine the results of all children and apply a final function on the resulting node.

    pre

    a function applied on a node before doing a recursion in the children

    post

    a function applied to the node built from the recursive application to all children

    combiner

    a function to combine the resulting values from all children with the current node

    init

    the initial value

    expr

    the expression on which to apply the transform

    See also

    simplePostTransform

    simplePreTransform

    simpleTransform

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

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

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

    Permalink
    Definition Classes
    Any
  22. def lookup[T](checker: (Source) ⇒ Boolean, toExtract: (Source) ⇒ T)(treeToLookInto: Source, treeToExtract: Source): Option[T]

    Permalink

    Given a tree toSearch present in treeToLookInto, if treeToLookInto has the same shape as treeToExtract, returns the matching expression in treeToExtract.

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

    Permalink
    Definition Classes
    AnyRef
  24. def noCombiner(e: Target, subCs: Seq[Unit]): Unit

    Permalink
  25. def noTransformer[C](e: Source, c: C): (Source, C)

    Permalink
  26. final def notify(): Unit

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

    Permalink
    Definition Classes
    AnyRef
  28. def postMap(f: (Target) ⇒ Option[Target], applyRec: Boolean = false)(e: Source): Target

    Permalink

    Post-transformation of the tree.

    Post-transformation of the tree.

    Takes a partial function of replacements. Substitutes after recurring down the trees.

    Supports two modes :

    • If applyRec is false (default), will only substitute once on each level. e.g.
    Add(a, Minus(b, c)) with replacements: Minus(b,c) -> z, Minus(e,c) -> d, b -> e

    will yield:

    Add(a, Minus(e, c))
    • If applyRec is true, it will substitute multiple times on each level: e.g.
    Add(a, Minus(b, c)) with replacements: Minus(e,c) -> d, b -> e, d -> f

    will yield:

    Add(a, f)
    Note

    The mode with applyRec true can diverge if f is not well formed (i.e. not convergent)

  29. def postTraversal(f: (Source) ⇒ Unit)(e: Source): Unit

    Permalink

    Post-traversal of the tree.

    Post-traversal of the tree.

    Invokes the input function on every node after visiting children.

    e.g.

    Add(a, Minus(b, c))

    will yield, in order:

    f(a), f(b), f(c), f(Minus(b, c)), f(Add(a, Minus(b, c)))
    f

    a function to apply on each node of the expression

    e

    the expression to traverse

  30. def preFoldWithContext[C](f: (Source, C) ⇒ C, combiner: (Source, C, Seq[C]) ⇒ C)(e: Source, c: C): C

    Permalink
  31. def preMap(f: (Source) ⇒ Option[Source], applyRec: Boolean = false)(e: Source): Target

    Permalink

    Pre-transformation of the tree.

    Pre-transformation of the tree.

    Takes a partial function of replacements and substitute before recursing down the trees.

    Supports two modes :

    • If applyRec is false (default), will only substitute once on each level.

    e.g.

    Add(a, Minus(b, c)) with replacements: Minus(b,c) -> d, b -> e, d -> f

    will yield:

    Add(a, d)   // And not Add(a, f) because it only substitute once for each level.
    • If applyRec is true, it will substitute multiple times on each level:

    e.g.

    Add(a, Minus(b, c)) with replacements: Minus(b,c) -> d, b -> e, d -> f

    will yield:

    Add(a, f)
    Note

    The mode with applyRec true can diverge if f is not well formed

  32. def preMapWithContext[C](f: (Source, C) ⇒ (Option[Source], C), applyRec: Boolean = false)(e: Source, c: C): Target

    Permalink

    Pre-transformation of the tree, with a context value from "top-down".

    Pre-transformation of the tree, with a context value from "top-down".

    Takes a partial function of replacements. Substitutes before recursing down the trees. The function returns an option of the new value, as well as the new context to be used for the recursion in its children. The context is "lost" when going back up, so changes made by one node will not be see by its siblings.

  33. def preTraversal(f: (Source) ⇒ Unit)(e: Source): Unit

    Permalink

    Pre-traversal of the tree.

    Pre-traversal of the tree.

    Invokes the input function on every node before visiting children. Traverse children from left to right Sources.

    e.g.

    Add(a, Minus(b, c))

    will yield, in order:

    f(Add(a, Minus(b, c))); f(a); f(Minus(b, c)); f(b); f(c)
    f

    a function to apply on each node of the expression

    e

    the expression to traverse

  34. def replace(substs: Map[Target, Target], expr: Source): Target

    Permalink

    Replaces bottom-up sub-expressions by looking up for them in a map

  35. def simplePostTransform(post: (Target) ⇒ Target)(tree: Source): Target

    Permalink

    A simpleTransform without a pre-transformation

  36. def simplePreTransform(pre: (Source) ⇒ Source)(tree: Source): Target

    Permalink

    A simpleTransform without a post-transformation

  37. def simpleTransform(pre: (Source) ⇒ Source, post: (Target) ⇒ Target)(tree: Source): Target

    Permalink

    A genericTransform with the trivial combiner that returns ()

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  40. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped