-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trying to move some of the work to the previous phase.
- Loading branch information
Showing
4 changed files
with
56 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
compiler/src/dotty/tools/dotc/transform/PrepareMixin.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package dotty.tools.dotc | ||
package transform | ||
|
||
import core._ | ||
import MegaPhase._ | ||
import Contexts.Context | ||
import Flags._ | ||
import SymUtils._ | ||
import Symbols._ | ||
import SymDenotations._ | ||
import Types._ | ||
import Decorators._ | ||
import DenotTransformers._ | ||
import StdNames._ | ||
import Names._ | ||
import NameKinds._ | ||
import NameOps._ | ||
import ast.Trees._ | ||
import collection.mutable | ||
|
||
object PrepareMixin { | ||
val name: String = "prepMixin" | ||
} | ||
|
||
class PrepareMixin extends MiniPhase with SymTransformer { thisPhase => | ||
import ast.tpd._ | ||
|
||
override def phaseName: String = PrepareMixin.name | ||
|
||
override def runsAfter: Set[String] = Set(Erasure.name) | ||
|
||
override def changesMembers: Boolean = true // the phase adds implementions of mixin accessors | ||
|
||
override def transformSym(sym: SymDenotation)(implicit ctx: Context): SymDenotation = | ||
if (sym.is(Accessor, butNot = Deferred) && sym.owner.is(Trait)) | ||
val sym1 = | ||
if (sym.is(Lazy)) sym | ||
else sym.copySymDenotation(initFlags = sym.flags &~ ParamAccessor | Deferred) | ||
sym1.ensureNotPrivate | ||
else | ||
sym | ||
end transformSym | ||
} |