aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/transform/NormalizeFlags.scala
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/src/dotty/tools/dotc/transform/NormalizeFlags.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/transform/NormalizeFlags.scala25
1 files changed, 25 insertions, 0 deletions
diff --git a/compiler/src/dotty/tools/dotc/transform/NormalizeFlags.scala b/compiler/src/dotty/tools/dotc/transform/NormalizeFlags.scala
new file mode 100644
index 000000000..755846904
--- /dev/null
+++ b/compiler/src/dotty/tools/dotc/transform/NormalizeFlags.scala
@@ -0,0 +1,25 @@
+package dotty.tools.dotc
+package transform
+
+import core._
+import DenotTransformers.SymTransformer
+import Phases.Phase
+import Contexts.Context
+import SymDenotations.SymDenotation
+import TreeTransforms.MiniPhaseTransform
+import Flags._, Symbols._
+
+/** 1. Widens all private[this] and protected[this] qualifiers to just private/protected
+ * 2. Sets PureInterface flag for traits that only have pure interface members and that
+ * do not have initialization code. A pure interface member is either an abstract
+ * or alias type definition or a deferred val or def.
+ */
+class NormalizeFlags extends MiniPhaseTransform with SymTransformer { thisTransformer =>
+ override def phaseName = "normalizeFlags"
+
+ def transformSym(ref: SymDenotation)(implicit ctx: Context) = {
+ var newFlags = ref.flags &~ Local
+ if (newFlags != ref.flags) ref.copySymDenotation(initFlags = newFlags)
+ else ref
+ }
+}