aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/DenotTransformers.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-07-23 19:04:25 +0200
committerMartin Odersky <odersky@gmail.com>2014-08-03 18:07:20 +0200
commit24bc239cfecca609a62d30a40ceae745fa8318cf (patch)
tree97c694fcbc93fa0ebe04fcbd219c7aab998894cd /src/dotty/tools/dotc/core/DenotTransformers.scala
parent4231d7a81fc9b49ceacac5a317817ee9feda79ae (diff)
downloaddotty-24bc239cfecca609a62d30a40ceae745fa8318cf.tar.gz
dotty-24bc239cfecca609a62d30a40ceae745fa8318cf.tar.bz2
dotty-24bc239cfecca609a62d30a40ceae745fa8318cf.zip
Added elimLocals miniphase
This phase drops the Local flag from all private[this] and protected[this] members. This allows subsequent code motions where code is moved from a class to its companion object. It invalidates variance checking, which is consequently disabled when retyping.
Diffstat (limited to 'src/dotty/tools/dotc/core/DenotTransformers.scala')
-rw-r--r--src/dotty/tools/dotc/core/DenotTransformers.scala13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/DenotTransformers.scala b/src/dotty/tools/dotc/core/DenotTransformers.scala
index e052a07ea..0e31d87e6 100644
--- a/src/dotty/tools/dotc/core/DenotTransformers.scala
+++ b/src/dotty/tools/dotc/core/DenotTransformers.scala
@@ -32,11 +32,11 @@ object DenotTransformers {
def transform(ref: SingleDenotation)(implicit ctx: Context): SingleDenotation
}
+ /** A transformer that only transforms the info field of denotations */
trait InfoTransformer extends DenotTransformer {
def transformInfo(tp: Type, sym: Symbol)(implicit ctx: Context): Type
- /** The transformation method */
def transform(ref: SingleDenotation)(implicit ctx: Context): SingleDenotation = {
val info1 = transformInfo(ref.info, ref.symbol)
if (info1 eq ref.info) ref
@@ -47,6 +47,17 @@ object DenotTransformers {
}
}
+ /** A transformer that only transforms SymDenotations */
+ trait SymTransformer extends DenotTransformer {
+
+ def transformSym(sym: SymDenotation)(implicit ctx: Context): SymDenotation
+
+ def transform(ref: SingleDenotation)(implicit ctx: Context): SingleDenotation = ref match {
+ case ref: SymDenotation => transformSym(ref)
+ case _ => ref
+ }
+ }
+
/** A `DenotTransformer` trait that has the identity as its `transform` method.
* You might want to inherit from this trait so that new denotations can be
* installed using `installAfter` and `enteredAfter` at the end of the phase.