diff options
author | Martin Odersky <odersky@gmail.com> | 2014-09-17 10:01:48 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2014-10-11 08:24:35 +0200 |
commit | 8918bd94813c254dcd0e19d0c16726bb5450e27a (patch) | |
tree | 83adc4b412667dcd6a6869cb5ab8e688a872208e /src/dotty/tools/dotc/core/SymDenotations.scala | |
parent | 70087826a64e027b72fc8235172bf2eee04b9d20 (diff) | |
download | dotty-8918bd94813c254dcd0e19d0c16726bb5450e27a.tar.gz dotty-8918bd94813c254dcd0e19d0c16726bb5450e27a.tar.bz2 dotty-8918bd94813c254dcd0e19d0c16726bb5450e27a.zip |
Make enteredAfter, installAfter more forgiving as to when they are called.
Instead of requiring to be called a given phase, change the context if
that is not the case.
Diffstat (limited to 'src/dotty/tools/dotc/core/SymDenotations.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/SymDenotations.scala | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index 073c9112d..1316e7872 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -1425,19 +1425,17 @@ object SymDenotations { /** If this class has the same `decls` scope reference in `phase` and * `phase.next`, install a new denotation with a cloned scope in `phase.next`. - * @pre Can only be called in `phase.next`. */ - def ensureFreshScopeAfter(phase: DenotTransformer)(implicit ctx: Context): Unit = { - assert(ctx.phaseId == phase.next.id) - val prevCtx = ctx.withPhase(phase) - val ClassInfo(pre, _, ps, decls, selfInfo) = classInfo - if (classInfo(prevCtx).decls eq decls) { - copySymDenotation( - info = ClassInfo(pre, classSymbol, ps, decls.cloneScope, selfInfo), - initFlags = this.flags &~ Frozen).installAfter(phase) + def ensureFreshScopeAfter(phase: DenotTransformer)(implicit ctx: Context): Unit = + if (ctx.phaseId != phase.next.id) ensureFreshScopeAfter(phase)(ctx.withPhase(phase.next)) + else { + val prevCtx = ctx.withPhase(phase) + val ClassInfo(pre, _, ps, decls, selfInfo) = classInfo + if (classInfo(prevCtx).decls eq decls) + copySymDenotation(info = ClassInfo(pre, classSymbol, ps, decls.cloneScope, selfInfo)) + .installAfter(phase) } } - } private case class Uncachable(tp: Type) extends UncachedGroundType |