@@ -30,18 +30,13 @@ object Mixin {
3030
3131/** This phase performs the following transformations:
3232 *
33- * 1. (done in `traitDefs` and `transformSym`) Map every concrete trait getter
33+ * 1. (done in `traitDefs` and `transformSym`) For every concrete trait getter
3434 *
3535 * <mods> def x(): T = expr
3636 *
37- * to the pair of definitions :
37+ * make it non-private, and add the definition of its trait setter :
3838 *
39- * <mods> def x(): T
40- * protected def initial$x(): T = { stats; expr }
41- *
42- * where `stats` comprises all statements between either the start of the trait
43- * or the previous field definition which are not definitions (i.e. are executed for
44- * their side effects).
39+ * <mods> def TraitName$_setter_$x(v: T): Unit
4540 *
4641 * 2. (done in `traitDefs`) Make every concrete trait setter
4742 *
@@ -51,61 +46,60 @@ object Mixin {
5146 *
5247 * <mods> def x_=(y: T)
5348 *
54- * 3. For a non-trait class C:
49+ * 3. (done in `transformSym`) For every module class constructor in traits,
50+ * remove its Private flag (but do not expand its name), since it will have
51+ * to be instantiated in the classes that mix in the trait.
52+ *
53+ * 4. For a non-trait class C:
5554 *
5655 * For every trait M directly implemented by the class (see SymUtils.mixin), in
5756 * reverse linearization order, add the following definitions to C:
5857 *
59- * 3 .1 (done in `traitInits`) For every parameter accessor `<mods> def x(): T` in M,
58+ * 4 .1 (done in `traitInits`) For every parameter accessor `<mods> def x(): T` in M,
6059 * in order of textual occurrence, add
6160 *
6261 * <mods> def x() = e
6362 *
6463 * where `e` is the constructor argument in C that corresponds to `x`. Issue
6564 * an error if no such argument exists.
6665 *
67- * 3 .2 (done in `traitInits`) For every concrete trait getter `<mods> def x(): T` in M
66+ * 4 .2 (done in `traitInits`) For every concrete trait getter `<mods> def x(): T` in M
6867 * which is not a parameter accessor, in order of textual occurrence, produce the following:
6968 *
70- * 3 .2.1 If `x` is also a member of `C`, and is a lazy val,
69+ * 4 .2.1 If `x` is also a member of `C`, and is a lazy val,
7170 *
7271 * <mods> lazy val x: T = super[M].x
7372 *
74- * 3 .2.2 If `x` is also a member of `C`, and M is a Dotty trait ,
73+ * 4 .2.2 If `x` is also a member of `C`, and is a module ,
7574 *
76- * <mods> def x() : T = super[M].initial$x( )
75+ * <mods> lazy module val x : T = new T$(this )
7776 *
78- * 3 .2.3 If `x` is also a member of `C`, and M is a Scala 2.x trait :
77+ * 4 .2.3 If `x` is also a member of `C`, and is something else :
7978 *
8079 * <mods> def x(): T = _
8180 *
82- * 3.2.4 If `x` is not a member of `C`, and M is a Dotty trait:
83- *
84- * super[M].initial$x()
85- *
86- * 3.2.5 If `x` is not a member of `C`, and M is a Scala2.x trait, nothing gets added.
87- *
81+ * 4.2.5 If `x` is not a member of `C`, nothing gets added.
8882 *
89- * 3 .3 (done in `superCallOpt`) The call:
83+ * 4 .3 (done in `superCallOpt`) The call:
9084 *
91- * super[M].< init>
85+ * super[M].$ init$()
9286 *
93- * 3 .4 (done in `setters`) For every concrete setter `<mods> def x_=(y: T)` in M:
87+ * 4 .4 (done in `setters`) For every concrete setter `<mods> def x_=(y: T)` in M:
9488 *
9589 * <mods> def x_=(y: T) = ()
9690 *
97- * 3 .5 (done in `mixinForwarders`) For every method
91+ * 4 .5 (done in `mixinForwarders`) For every method
9892 * `<mods> def f[Ts](ps1)...(psN): U` imn M` that needs to be disambiguated:
9993 *
10094 * <mods> def f[Ts](ps1)...(psN): U = super[M].f[Ts](ps1)...(psN)
10195 *
10296 * A method in M needs to be disambiguated if it is concrete, not overridden in C,
10397 * and if it overrides another concrete method.
10498 *
105- * 4 . (done in `transformTemplate` and `transformSym`) Drop all parameters from trait
106- * constructors.
99+ * 5 . (done in `transformTemplate` and `transformSym`) Drop all parameters from trait
100+ * constructors, and rename them to `nme.TRAIT_CONSTRUCTOR` .
107101 *
108- * 5 . (done in `transformSym`) Drop ParamAccessor flag from all parameter accessors in traits.
102+ * 6 . (done in `transformSym`) Drop ParamAccessor flag from all parameter accessors in traits.
109103 *
110104 * Conceptually, this is the second half of the previous mixin phase. It needs to run
111105 * after erasure because it copies references to possibly private inner classes and objects
0 commit comments