From 1a3aeb147dff4875d8bf6701571babdaca9d869c Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 22 Jul 2016 16:12:16 +0200 Subject: Resume suspensions also when reading from classfiles Make treatment in Scala2Unpickler and Namer the same and factor out common functionality. --- src/dotty/tools/dotc/core/Types.scala | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/dotty/tools/dotc/core/Types.scala') diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 8019750bf..373428108 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -3049,12 +3049,20 @@ object Types { /** A class for temporary class infos where `parents` are not yet known. */ final class TempClassInfo(prefix: Type, cls: ClassSymbol, decls: Scope, selfInfo: DotClass) extends CachedClassInfo(prefix, cls, Nil, decls, selfInfo) { - + /** A list of actions that were because they rely on the class info of `cls` to * be no longer temporary. These actions will be performed once `cls` gets a real * ClassInfo. */ - var suspensions: List[() => Unit] = Nil + private var suspensions: List[() => Unit] = Nil + + def addSuspension(suspension: () => Unit): Unit = suspensions ::= suspension + + /** Install classinfo with known parents in `denot` and resume all suspensions */ + def finalize(denot: SymDenotation, parents: List[TypeRef])(implicit ctx: Context) = { + denot.info = derivedClassInfo(classParents = parents) + suspensions.foreach(_()) + } } object ClassInfo { -- cgit v1.2.3