aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-07-22 16:12:16 +0200
committerMartin Odersky <odersky@gmail.com>2016-07-22 16:12:16 +0200
commit1a3aeb147dff4875d8bf6701571babdaca9d869c (patch)
tree5463a6047564040ad40e588215d754d1c090a132 /src/dotty/tools/dotc/core/Types.scala
parentc37185d3307e2b02e25e888fd44d5e8bba95aa1d (diff)
downloaddotty-1a3aeb147dff4875d8bf6701571babdaca9d869c.tar.gz
dotty-1a3aeb147dff4875d8bf6701571babdaca9d869c.tar.bz2
dotty-1a3aeb147dff4875d8bf6701571babdaca9d869c.zip
Resume suspensions also when reading from classfiles
Make treatment in Scala2Unpickler and Namer the same and factor out common functionality.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala12
1 files changed, 10 insertions, 2 deletions
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 {