The phase performs the following transformations on terms:
The phase performs the following transformations on terms:
-
An class which is not an interface and is not static gets an outer accessor (@see outerDefs).
1a. A class which is not a trait gets an outer field.
- A constructor of a non-trait inner class gets an outer parameter.
- A reference C.this where C refers to an outer class is replaced by a selection this.$outer$$C1 ... .$outer$$Cn (@see outerPath)
-
- A call to a constructor Q.<init>(args) or Q.$init$(args) where Q != this and the constructor belongs to a non-static class is augmented by an outer argument. E.g. Q.<init>(OUTER, args) where OUTER is the qualifier corresponding to the singleton type Q.
- A call to a constructor this.<init>(args) in a secondary constructor is augmented to this.<init>(OUTER, args) where OUTER is the last parameter of the secondary constructor.
- Remove private modifier from class members M that are accessed from an inner class.
- Remove protected modifier from class members M that are accessed without a super qualifier accessed from an inner class or trait.
- Remove private and protected modifiers from type symbols
- Remove private modifiers from members of traits
Note: The whole transform is run in phase explicitOuter.next.
A base class for transformers that maintain outerParam values for outer parameters of constructors.
A base class for transformers that maintain outerParam values for outer parameters of constructors. The class provides methods for referencing via outer.
A standard phase template
A standard phase template
Names of phases that must run before this phase.
Names of phases that must run before this phase.
Name of the phase that this phase must follow immediately.
Name of the phase that this phase must follow immediately.
This class does not change linearization
This class does not change linearization
Is this component enabled? Default is true.
Is this component enabled? Default is true.
Does given clazz define an outer field?
SubComponent are added to a HashSet and two phases are the same if they have the same name
SubComponent are added to a HashSet and two phases are the same if they have the same name
True if this phase runs before all other phases.
True if this phase runs before all other phases. Usually, parser
.
True if this phase is not provided by a plug-in.
True if this phase is not provided by a plug-in.
Create a new phase which applies transformer
Create a new phase which applies transformer
The transformer factory
The transformer factory
The phase corresponding to this subcomponent in the current compiler run
The phase corresponding to this subcomponent in the current compiler run
the name of the phase:
the name of the phase:
The following flags may be set by this phase:
The following flags may be set by this phase:
New flags defined by the phase which are not valid until immediately after it
New flags defined by the phase which are not valid until immediately after it
Names of phases required by this component.
Names of phases required by this component. Default is Nil
.
Names of phases that must run after this phase.
Names of phases that must run after this phase. Default is Nil
.
True if this phase runs after all other phases.
True if this phase runs after all other phases. Usually, terminal
.
The type transformation method:
The type transformation method:
- Add an outer parameter to the formal parameters of a constructor in an inner non-trait class;
- Add a protected $outer field to an inner class which is not a trait.
-
Add an outer accessor $outer$$C to every inner class with fully qualified name C that is not an interface. The outer accessor is abstract for traits, concrete for other classes.
3a. Also add overriding accessor defs to every class that inherits mixin classes with outer accessor defs (unless the superclass already inherits the same mixin).
- Make all super accessors and modules in traits non-private, mangling their names.
- Remove protected flag from all members of traits.
Note: this transformInfo need not be reflected as the JVM reflection already elides outer pointers.
This class ...
1.0