transform - Scala Compiler 2.11.6 - scala.tools.nsc.transform
Keywords: transform Scala Compiler 2.11.6 scala.tools.nsc.transform

scala.tools.nsc

# transform

#### package transform

Content Hierarchy Learn more about scaladoc diagrams
Visibility

1. Public
2. All

### Type Members

1. #### abstract class AddInterfaces extends SubComponent with InfoTransform

2. #### abstract class CleanUp extends Statics with Transform with TreeDSL

3. #### abstract class Constructors extends Statics with Transform with TreeDSL

   This phase converts classes with parameters into Java-like classes with fields, which are assigned to from constructors.

4. #### abstract class Delambdafy extends SubComponent with Transform with TypingTransformers with TreeDSL with TypeAdaptingTransformer

   This transformer is responsible for turning lambdas into anonymous classes.

   This transformer is responsible for turning lambdas into anonymous classes. The main assumption it makes is that a lambda {args => body} has been turned into {args => liftedBody()} where lifted body is a top level method that implements the body of the lambda. Currently Uncurry is responsible for that transformation.

   From a lambda, Delambdafy will create 1) a static forwarder at the top level of the class that contained the lambda 2) a new top level class that a) has fields and a constructor taking the captured environment (including possibly the "this" reference) b) an apply method that calls the static forwarder c) if needed a bridge method for the apply method 3) an instantiation of the newly created class which replaces the lambda

   TODO the main work left to be done is to plug into specialization. Primarily that means choosing a specialized FunctionN trait instead of the generic FunctionN trait as a parent and creating the appropriately named applysp method

5. #### abstract class Erasure extends AddInterfaces with reflect.internal.transform.Erasure with Analyzer with TypingTransformers with TreeDSL with TypeAdaptingTransformer

6. #### abstract class ExplicitOuter extends SubComponent with InfoTransform with TypingTransformers with TreeDSL

   This class ...

   This class ...

   Version

     1.0

7. #### abstract class ExtensionMethods extends SubComponent with Transform with TypingTransformers

   Perform Step 1 in the inline classes SIP: Creates extension methods for all methods in a value class, except parameter or super accessors, or constructors.

   Perform Step 1 in the inline classes SIP: Creates extension methods for all methods in a value class, except parameter or super accessors, or constructors.

   Version

     2.10

8. #### abstract class Flatten extends SubComponent with InfoTransform

9. #### trait InfoTransform extends SubComponent with Transform

   An InfoTransform contains a compiler phase that transforms trees and symbol infos -- making sure they stay consistent.

   An InfoTransform contains a compiler phase that transforms trees and symbol infos -- making sure they stay consistent. The symbol info is transformed assuming it is consistent right before this phase. The info transformation is triggered by Symbol::rawInfo, which caches the results in the symbol's type history. This way sym.info (during an enteringPhase(p)) can look up what the symbol's info should look like at the beginning of phase p. (If the transformed info had not been stored yet, rawInfo will compute the info by composing the info-transformers of the most recent phase before p, up to the transformer of the phase right before p.)

   Concretely, enteringPhase(p) { sym.info } yields the info *before* phase p has transformed it. Imagine you're a phase and it all makes sense.

10. #### trait InlineErasure extends AnyRef

11. #### abstract class LambdaLift extends SubComponent with InfoTransform

12. #### abstract class LazyVals extends SubComponent with Transform with TypingTransformers with TreeDSL

13. #### abstract class Mixin extends SubComponent with InfoTransform with TreeDSL

14. #### abstract class OverridingPairs extends SymbolPairs

    A class that yields a kind of iterator (`Cursor`), which yields pairs of corresponding symbols visible in some base class, unless there's a parent class that already contains the same pairs.

    A class that yields a kind of iterator (`Cursor`), which yields pairs of corresponding symbols visible in some base class, unless there's a parent class that already contains the same pairs. Most of the logic is in SymbolPairs, which contains generic pair-oriented traversal logic.

15. #### trait PostErasure extends SubComponent with InfoTransform with TypingTransformers with reflect.internal.transform.PostErasure

    This phase maps ErasedValueTypes to the underlying unboxed representation and performs peephole optimizations.

16. #### abstract class SampleTransform extends SubComponent with Transform

    A sample transform.

17. #### abstract class SpecializeTypes extends SubComponent with InfoTransform with TypingTransformers

    Specialize code on types.

    Specialize code on types.

    Make sure you've read the thesis:

    Iulian Dragos: Compiling Scala for Performance (chapter 4)

    There are some things worth noting, (possibly) not mentioned there: 0) Make sure you understand the meaning of various `SpecializedInfo` descriptors defined below.

    1) Specializing traits by introducing bridges in specialized methods of the specialized trait may introduce problems during mixin composition. Concretely, it may cause cyclic calls and result in a stack overflow. See ticket #4351. This was solved by introducing an `Abstract` specialized info descriptor. Instead of generating a bridge in the trait, an abstract method is generated.

    2) Specialized private members sometimes have to be switched to protected. In some cases, even this is not enough. Example:

        class A[@specialized T](protected val d: T) {
          def foo(that: A[T]) = that.d
        }

    Specialization will generate a specialized class and a specialized method:

        class A$mcI$sp(protected val d: Int) extends A[Int] {
          def foo(that: A[Int]) = foo$mcI$sp(that)
          def foo(that: A[Int]) = that.d
        }

    Above, `A$mcI$sp` cannot access `d`, so the method cannot be typechecked.

18. #### abstract class Statics extends SubComponent with Transform with TreeDSL

19. #### abstract class TailCalls extends SubComponent with Transform

    Perform tail recursive call elimination.

    Perform tail recursive call elimination.

    Version

      1.0

20. #### trait Transform extends SubComponent

    A base class for transforms.

    A base class for transforms.

    A transform contains a compiler phase which applies a tree transformer.

    Version

      1.0

21. #### trait TypeAdaptingTransformer extends AnyRef

    A trait usable by transforms that need to adapt trees of one type to another type

22. #### trait TypingTransformers extends AnyRef

    A base class for transforms.

    A base class for transforms. A transform contains a compiler phase which applies a tree transformer.

23. #### abstract class UnCurry extends SubComponent with InfoTransform with reflect.internal.transform.UnCurry with TypingTransformers with TreeDSL

    - uncurry all symbol and tree types (@see UnCurryPhase) -- this includes normalizing all proper types.

    - uncurry all symbol and tree types (@see UnCurryPhase) -- this includes normalizing all proper types.

    - for every curried parameter list: (ps_1) ... (ps_n) ==> (ps_1, ..., ps_n)
    - for every curried application: f(args_1)...(args_n) ==> f(args_1, ..., args_n)
    - for every type application: f[Ts] ==> f[Ts]() unless followed by parameters
    - for every use of a parameterless function: f ==> f() and q.f ==> q.f()
    - for every def-parameter: x: => T ==> x: () => T
    - for every use of a def-parameter: x ==> x.apply()
    - for every argument to a def parameter `x: => T': if argument is not a reference to a def parameter: convert argument` e`to (expansion of)` () => e'
    - for every repeated Scala parameter `x: T*' --> x: Seq[T].`
    - for every repeated Java parameter `x: T...' --> x: Array[T], except: if T is an unbounded abstract type, replace --> x: Array[Object]`
    - for every argument list that corresponds to a repeated Scala parameter (a_1, ..., a_n) => (Seq(a_1, ..., a_n))
    - for every argument list that corresponds to a repeated Java parameter (a_1, ..., a_n) => (Array(a_1, ..., a_n))
    - for every argument list that is an escaped sequence (a_1:_*) => (a_1) (possibly converted to sequence or array, as needed)
    - convert implicit method types to method types
    - convert non-trivial catches in try statements to matches
    - convert non-local returns to throws with enclosing try statements.
    - convert try-catch expressions in contexts where there might be values on the stack to a local method and a call to it (since an exception empties the evaluation stack):

    meth(x_1,..., try { x_i } catch { ..}, .. x_b0) ==> { def liftedTry$1 = try { x_i } catch { .. } meth(x_1, .., liftedTry$1(), .. ) }

### Value Members

1. #### package patmat

### Ungrouped