diff options
author | Martin Odersky <odersky@gmail.com> | 2014-08-18 21:48:59 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-08-18 21:48:59 +0200 |
commit | 3afdefd1796af0aa256dfde6a4e3588c0fb00e61 (patch) | |
tree | 08f2e4838fe445617e7a111e2de08f43ca5e698d /src | |
parent | f366f867853be9879b9d17af832de2ad00f7f06b (diff) | |
download | dotty-3afdefd1796af0aa256dfde6a4e3588c0fb00e61.tar.gz dotty-3afdefd1796af0aa256dfde6a4e3588c0fb00e61.tar.bz2 dotty-3afdefd1796af0aa256dfde6a4e3588c0fb00e61.zip |
Rename in Phase: name -> phaseName
Most transformations are subclasses of phase. Having a generic name
like `name` in scope everywhere is therefore very risky.
Diffstat (limited to 'src')
22 files changed, 40 insertions, 40 deletions
diff --git a/src/dotty/tools/dotc/ElimLocals.scala b/src/dotty/tools/dotc/ElimLocals.scala index b5843375a..20afc8eb4 100644 --- a/src/dotty/tools/dotc/ElimLocals.scala +++ b/src/dotty/tools/dotc/ElimLocals.scala @@ -11,7 +11,7 @@ import Flags.Local /** Widens all private[this] and protected[this] qualifiers to just private/protected */ class ElimLocals extends MiniPhaseTransform with SymTransformer { thisTransformer => - override def name = "elimLocals" + override def phaseName = "elimLocals" def transformSym(ref: SymDenotation)(implicit ctx: Context) = dropLocal(ref) diff --git a/src/dotty/tools/dotc/core/Decorators.scala b/src/dotty/tools/dotc/core/Decorators.scala index c96f1ba31..3575029e8 100644 --- a/src/dotty/tools/dotc/core/Decorators.scala +++ b/src/dotty/tools/dotc/core/Decorators.scala @@ -131,7 +131,7 @@ object Decorators { implicit class PhaseListDecorator(val names: List[String]) extends AnyVal { def containsPhase(phase: Phase): Boolean = phase match { case phase: TreeTransformer => phase.transformations.exists(trans => containsPhase(trans.phase)) - case _ => names exists (n => n == "all" || phase.name.startsWith(n)) + case _ => names exists (n => n == "all" || phase.phaseName.startsWith(n)) } } diff --git a/src/dotty/tools/dotc/core/Phases.scala b/src/dotty/tools/dotc/core/Phases.scala index cecc5d1d7..43dadf38d 100644 --- a/src/dotty/tools/dotc/core/Phases.scala +++ b/src/dotty/tools/dotc/core/Phases.scala @@ -48,19 +48,19 @@ object Phases { object NoPhase extends Phase { override def exists = false - def name = "<no phase>" + def phaseName = "<no phase>" def run(implicit ctx: Context): Unit = unsupported("run") def transform(ref: SingleDenotation)(implicit ctx: Context): SingleDenotation = unsupported("transform") } object SomePhase extends Phase { - def name = "<some phase>" + def phaseName = "<some phase>" def run(implicit ctx: Context): Unit = unsupported("run") } /** A sentinel transformer object */ class TerminalPhase extends DenotTransformer { - def name = "terminal" + def phaseName = "terminal" def run(implicit ctx: Context): Unit = unsupported("run") def transform(ref: SingleDenotation)(implicit ctx: Context): SingleDenotation = unsupported("transform") @@ -77,30 +77,30 @@ object Phases { var i = 0 while (i < phasess.length) { if (phasess(i).length > 1) { - val phasesInBlock: Set[String] = phasess(i).map(_.name).toSet + val phasesInBlock: Set[String] = phasess(i).map(_.phaseName).toSet for(phase<-phasess(i)) { phase match { case p: MiniPhase => val unmetRequirements = p.runsAfterGroupsOf &~ prevPhases assert(unmetRequirements.isEmpty, - s"${phase.name} requires ${unmetRequirements.mkString(", ")} to be in different TreeTransformer") + s"${phase.phaseName} requires ${unmetRequirements.mkString(", ")} to be in different TreeTransformer") case _ => - assert(false, s"Only tree transforms can be squashed, ${phase.name} can not be squashed") + assert(false, s"Only tree transforms can be squashed, ${phase.phaseName} can not be squashed") } } val transforms = phasess(i).asInstanceOf[List[MiniPhase]].map(_.treeTransform) val block = new TreeTransformer { - override def name: String = transformations.map(_.phase.name).mkString("TreeTransform:{", ", ", "}") + override def phaseName: String = transformations.map(_.phase.phaseName).mkString("TreeTransform:{", ", ", "}") override def transformations: Array[TreeTransform] = transforms.toArray } squashedPhases += block - prevPhases ++= phasess(i).map(_.name) + prevPhases ++= phasess(i).map(_.phaseName) block.init(this, phasess(i).head.id, phasess(i).last.id) } else { squashedPhases += phasess(i).head - prevPhases += phasess(i).head.name + prevPhases += phasess(i).head.phaseName } i += 1 } @@ -122,7 +122,7 @@ object Phases { val unmetPreceedeRequirements = phases(i).runsAfter -- phasesAfter assert(unmetPreceedeRequirements.isEmpty, s"phase ${phases(i)} has unmet requirement: ${unmetPreceedeRequirements.mkString(", ")} should precede this phase") - phasesAfter += phases(i).name + phasesAfter += phases(i).phaseName i += 1 } var lastTransformerId = i @@ -148,7 +148,7 @@ object Phases { config.println(s"nextDenotTransformerId = ${nextDenotTransformerId.deep}") } - def phaseNamed(name: String) = phases.find(_.name == name).getOrElse(NoPhase) + def phaseNamed(name: String) = phases.find(_.phaseName == name).getOrElse(NoPhase) /** A cache to compute the phase with given name, which * stores the phase as soon as phaseNamed returns something @@ -182,7 +182,7 @@ object Phases { trait Phase extends DotClass { - def name: String + def phaseName: String /** List of names of phases that should precede this phase */ def runsAfter: Set[String] = Set.empty @@ -192,7 +192,7 @@ object Phases { def runOn(units: List[CompilationUnit])(implicit ctx: Context): Unit = for (unit <- units) run(ctx.fresh.setPhase(this).setCompilationUnit(unit)) - def description: String = name + def description: String = phaseName def checkable: Boolean = true @@ -223,9 +223,9 @@ object Phases { assert(myPeriod == Periods.InvalidPeriod, s"phase $this has already been used once; cannot be reused") myBase = base myPeriod = Period(start, end) - myErasedTypes = prev.name == erasureName || prev.erasedTypes - myFlatClasses = prev.name == flattenName || prev.flatClasses - myRefChecked = prev.name == refChecksName || prev.refChecked + myErasedTypes = prev.phaseName == erasureName || prev.erasedTypes + myFlatClasses = prev.phaseName == flattenName || prev.flatClasses + myRefChecked = prev.phaseName == refChecksName || prev.refChecked } protected[Phases] def init(base: ContextBase, id: Int): Unit = init(base, id, id) @@ -244,6 +244,6 @@ object Phases { final def iterator = Iterator.iterate(this)(_.next) takeWhile (_.hasNext) - override def toString = name + override def toString = phaseName } }
\ No newline at end of file diff --git a/src/dotty/tools/dotc/transform/CollectEntryPoints.scala b/src/dotty/tools/dotc/transform/CollectEntryPoints.scala index d5ae90840..7d854b8c9 100644 --- a/src/dotty/tools/dotc/transform/CollectEntryPoints.scala +++ b/src/dotty/tools/dotc/transform/CollectEntryPoints.scala @@ -35,7 +35,7 @@ class CollectEntryPoints extends MiniPhaseTransform { def getEntryPoints = entryPoints.toList - override def name: String = "collectEntryPoints" + override def phaseName: String = "collectEntryPoints" override def transformDefDef(tree: tpd.DefDef)(implicit ctx: Context, info: TransformerInfo): tpd.Tree = { if (tree.symbol.owner.isClass && isJavaEntryPoint(tree.symbol)) { // collecting symbols for entry points here (as opposed to GenBCode where they are used) diff --git a/src/dotty/tools/dotc/transform/Constructors.scala b/src/dotty/tools/dotc/transform/Constructors.scala index 890948715..34c90fdc2 100644 --- a/src/dotty/tools/dotc/transform/Constructors.scala +++ b/src/dotty/tools/dotc/transform/Constructors.scala @@ -11,7 +11,7 @@ import dotty.tools.dotc.core.StdNames._ */ class Constructors extends MiniPhaseTransform { - override def name: String = "constructors" + override def phaseName: String = "constructors" override def transformDefDef(tree: DefDef)(implicit ctx: Context, info: TransformerInfo): Tree = { if(tree.symbol.isClassConstructor) { val claz = tree.symbol.enclosingClass.asClass diff --git a/src/dotty/tools/dotc/transform/ElimByName.scala b/src/dotty/tools/dotc/transform/ElimByName.scala index 38225f17f..93ac64044 100644 --- a/src/dotty/tools/dotc/transform/ElimByName.scala +++ b/src/dotty/tools/dotc/transform/ElimByName.scala @@ -38,7 +38,7 @@ import ast.Trees._ class ElimByName extends MiniPhaseTransform with InfoTransformer { thisTransformer => import ast.tpd._ - override def name: String = "elimByName" + override def phaseName: String = "elimByName" override def runsAfterGroupsOf: Set[String] = Set("splitter") // assumes idents and selects have symbols; interferes with splitter distribution diff --git a/src/dotty/tools/dotc/transform/ElimRepeated.scala b/src/dotty/tools/dotc/transform/ElimRepeated.scala index 04ca77a2d..eb44c3e2c 100644 --- a/src/dotty/tools/dotc/transform/ElimRepeated.scala +++ b/src/dotty/tools/dotc/transform/ElimRepeated.scala @@ -23,7 +23,7 @@ import TypeUtils._ class ElimRepeated extends MiniPhaseTransform with InfoTransformer { thisTransformer => import ast.tpd._ - override def name = "elimRepeated" + override def phaseName = "elimRepeated" def transformInfo(tp: Type, sym: Symbol)(implicit ctx: Context): Type = elimRepeated(tp) diff --git a/src/dotty/tools/dotc/transform/Erasure.scala b/src/dotty/tools/dotc/transform/Erasure.scala index e85161f2d..a48e4b3d0 100644 --- a/src/dotty/tools/dotc/transform/Erasure.scala +++ b/src/dotty/tools/dotc/transform/Erasure.scala @@ -27,7 +27,7 @@ import TypeUtils._ class Erasure extends Phase with DenotTransformer { thisTransformer => - override def name: String = "erasure" + override def phaseName: String = "erasure" /** List of names of phases that should precede this phase */ override def runsAfter: Set[String] = Set("typeTestsCasts"/*, "intercepted"*/, "splitter", "elimRepeated") diff --git a/src/dotty/tools/dotc/transform/ExtensionMethods.scala b/src/dotty/tools/dotc/transform/ExtensionMethods.scala index 82db07809..47ded1aef 100644 --- a/src/dotty/tools/dotc/transform/ExtensionMethods.scala +++ b/src/dotty/tools/dotc/transform/ExtensionMethods.scala @@ -27,7 +27,7 @@ class ExtensionMethods extends MacroTransform with DenotTransformer with FullPar import tpd._ /** the following two members override abstract members in Transform */ - val name: String = "extmethods" + override def phaseName: String = "extmethods" override def runsAfter: Set[String] = Set("elimRepeated") // TODO: add tailrec diff --git a/src/dotty/tools/dotc/transform/FirstTransform.scala b/src/dotty/tools/dotc/transform/FirstTransform.scala index 39791918b..3eaa26843 100644 --- a/src/dotty/tools/dotc/transform/FirstTransform.scala +++ b/src/dotty/tools/dotc/transform/FirstTransform.scala @@ -26,7 +26,7 @@ import NameOps._ class FirstTransform extends MiniPhaseTransform with IdentityDenotTransformer { thisTransformer => import ast.tpd._ - override def name = "companions" + override def phaseName = "companions" /** Reorder statements so that module classes always come after their companion classes, add missing companion classes */ private def reorderAndComplete(stats: List[Tree])(implicit ctx: Context): List[Tree] = { diff --git a/src/dotty/tools/dotc/transform/InterceptedMethods.scala b/src/dotty/tools/dotc/transform/InterceptedMethods.scala index a8ca754de..463ab86c4 100644 --- a/src/dotty/tools/dotc/transform/InterceptedMethods.scala +++ b/src/dotty/tools/dotc/transform/InterceptedMethods.scala @@ -44,7 +44,7 @@ class InterceptedMethods extends MiniPhaseTransform { import tpd._ - override def name: String = "intercepted" + override def phaseName: String = "intercepted" private var getClassMethods: Set[Symbol] = _ private var poundPoundMethods: Set[Symbol] = _ @@ -64,7 +64,7 @@ class InterceptedMethods extends MiniPhaseTransform { override def transformSelect(tree: tpd.Select)(implicit ctx: Context, info: TransformerInfo): Tree = { if (tree.symbol.isTerm && poundPoundMethods.contains(tree.symbol.asTerm)) { val rewrite = PoundPoundValue(tree.qualifier) - ctx.log(s"$name rewrote $tree to $rewrite") + ctx.log(s"$phaseName rewrote $tree to $rewrite") rewrite } else tree @@ -136,7 +136,7 @@ class InterceptedMethods extends MiniPhaseTransform { case _ => unknown } - ctx.log(s"$name rewrote $tree to $rewrite") + ctx.log(s"$phaseName rewrote $tree to $rewrite") rewrite } else tree diff --git a/src/dotty/tools/dotc/transform/LazyVals.scala b/src/dotty/tools/dotc/transform/LazyVals.scala index 75fc7ef2e..e85508b8e 100644 --- a/src/dotty/tools/dotc/transform/LazyVals.scala +++ b/src/dotty/tools/dotc/transform/LazyVals.scala @@ -45,7 +45,7 @@ class LazyValTranformContext { class LazyValsTransform extends MiniPhaseTransform with DenotTransformer { - override def name: String = "LazyVals" + override def phaseName: String = "LazyVals" /** List of names of phases that should have finished their processing of all compilation units * before this phase starts */ diff --git a/src/dotty/tools/dotc/transform/Literalize.scala b/src/dotty/tools/dotc/transform/Literalize.scala index 03b2b9978..79f0dd493 100644 --- a/src/dotty/tools/dotc/transform/Literalize.scala +++ b/src/dotty/tools/dotc/transform/Literalize.scala @@ -18,7 +18,7 @@ import ast.Trees._ class Literalize extends MiniPhaseTransform { import ast.tpd._ - override def name: String = "literalize" + override def phaseName: String = "literalize" /** Note: Demanding idempotency instead of purity is strictly speaking too loose. * Example diff --git a/src/dotty/tools/dotc/transform/PatternMatcher.scala b/src/dotty/tools/dotc/transform/PatternMatcher.scala index fdda670b1..090b04028 100644 --- a/src/dotty/tools/dotc/transform/PatternMatcher.scala +++ b/src/dotty/tools/dotc/transform/PatternMatcher.scala @@ -19,7 +19,7 @@ import ast.Trees._ class PatternMatcher extends MiniPhaseTransform { import ast.tpd._ - override def name: String = "patternMatcher" + override def phaseName: String = "patternMatcher" override def transformCaseDef(tree: CaseDef)(implicit ctx: Context, info: TransformerInfo): Tree = cpy.CaseDef(tree)(Literal(Constant("<eliminated pattern>")), tree.guard, tree.body) diff --git a/src/dotty/tools/dotc/transform/Splitter.scala b/src/dotty/tools/dotc/transform/Splitter.scala index 6def41419..d9c1c5e5e 100644 --- a/src/dotty/tools/dotc/transform/Splitter.scala +++ b/src/dotty/tools/dotc/transform/Splitter.scala @@ -15,7 +15,7 @@ import Contexts._, Types._, Decorators._, Denotations._, Symbols._, SymDenotatio class Splitter extends MiniPhaseTransform { import ast.tpd._ - override def name: String = "splitter" + override def phaseName: String = "splitter" /** Replace self referencing idents with ThisTypes. */ override def transformIdent(tree: Ident)(implicit ctx: Context, info: TransformerInfo) = tree.tpe match { diff --git a/src/dotty/tools/dotc/transform/SuperAccessors.scala b/src/dotty/tools/dotc/transform/SuperAccessors.scala index 510e0abf0..2ef104db4 100644 --- a/src/dotty/tools/dotc/transform/SuperAccessors.scala +++ b/src/dotty/tools/dotc/transform/SuperAccessors.scala @@ -54,7 +54,7 @@ class SuperAccessors extends MacroTransform with IdentityDenotTransformer { this import tpd._ /** the following two members override abstract members in Transform */ - val name: String = "superaccessors" + override def phaseName: String = "superaccessors" protected def newTransformer(implicit ctx: Context): Transformer = new SuperAccTransformer diff --git a/src/dotty/tools/dotc/transform/SyntheticMethods.scala b/src/dotty/tools/dotc/transform/SyntheticMethods.scala index 383abc186..0af3ef895 100644 --- a/src/dotty/tools/dotc/transform/SyntheticMethods.scala +++ b/src/dotty/tools/dotc/transform/SyntheticMethods.scala @@ -34,7 +34,7 @@ import scala.language.postfixOps class SyntheticMethods extends MiniPhaseTransform with IdentityDenotTransformer { thisTransformer => import ast.tpd._ - val name = "synthetics" + override def phaseName = "synthetics" private var valueSymbols: List[Symbol] = _ private var caseSymbols: List[Symbol] = _ diff --git a/src/dotty/tools/dotc/transform/TailRec.scala b/src/dotty/tools/dotc/transform/TailRec.scala index 6aabdb20e..83e1e5426 100644 --- a/src/dotty/tools/dotc/transform/TailRec.scala +++ b/src/dotty/tools/dotc/transform/TailRec.scala @@ -68,7 +68,7 @@ class TailRec extends MiniPhaseTransform with DenotTransformer with FullParamete override def transform(ref: SingleDenotation)(implicit ctx: Context): SingleDenotation = ref - override def name: String = "tailrec" + override def phaseName: String = "tailrec" final val labelPrefix = "tailLabel" final val labelFlags = Flags.Synthetic | Flags.Label diff --git a/src/dotty/tools/dotc/transform/TreeTransform.scala b/src/dotty/tools/dotc/transform/TreeTransform.scala index 22f785163..4e83142f7 100644 --- a/src/dotty/tools/dotc/transform/TreeTransform.scala +++ b/src/dotty/tools/dotc/transform/TreeTransform.scala @@ -148,7 +148,7 @@ object TreeTransforms { def runsAfterGroupsOf: Set[String] = Set.empty protected def mkTreeTransformer = new TreeTransformer { - override def name: String = thisPhase.name + override def phaseName: String = thisPhase.phaseName override def transformations = Array(treeTransform) } diff --git a/src/dotty/tools/dotc/transform/TypeTestsCasts.scala b/src/dotty/tools/dotc/transform/TypeTestsCasts.scala index 8d420546f..2a3bc7991 100644 --- a/src/dotty/tools/dotc/transform/TypeTestsCasts.scala +++ b/src/dotty/tools/dotc/transform/TypeTestsCasts.scala @@ -24,7 +24,7 @@ import Erasure.Boxing.box class TypeTestsCasts extends MiniPhaseTransform { import ast.tpd._ - override def name: String = "typeTestsCasts" + override def phaseName: String = "typeTestsCasts" override def transformTypeApply(tree: TypeApply)(implicit ctx: Context, info: TransformerInfo): Tree = ctx.traceIndented(s"transforming ${tree.show}", show = true) { tree.fun match { diff --git a/src/dotty/tools/dotc/typer/FrontEnd.scala b/src/dotty/tools/dotc/typer/FrontEnd.scala index 697830fb1..4c5e2549b 100644 --- a/src/dotty/tools/dotc/typer/FrontEnd.scala +++ b/src/dotty/tools/dotc/typer/FrontEnd.scala @@ -10,7 +10,7 @@ import util.Stats._ class FrontEnd extends Phase { - def name = "frontend" + override def phaseName = "frontend" def monitor(doing: String)(body: => Unit)(implicit ctx: Context) = try body diff --git a/src/dotty/tools/dotc/typer/RefChecks.scala b/src/dotty/tools/dotc/typer/RefChecks.scala index 67cb1745f..715960ee5 100644 --- a/src/dotty/tools/dotc/typer/RefChecks.scala +++ b/src/dotty/tools/dotc/typer/RefChecks.scala @@ -685,7 +685,7 @@ class RefChecks extends MiniPhase with IdentityDenotTransformer { thisTransforme import tpd._ - val name: String = "refchecks" + override def phaseName: String = "refchecks" val treeTransform = new Transform(NoLevelInfo) |