aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/pickling
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-03-03 16:10:21 +0100
committerMartin Odersky <odersky@gmail.com>2013-03-03 16:10:21 +0100
commita1049e6227d412ce6bdd9065a350cb20921987e2 (patch)
tree506849218a5178916e6fa87e0d0f0636e50e4434 /src/dotty/tools/dotc/core/pickling
parent30bfa5b1be62652fc07292d36ed1261edbcdb362 (diff)
downloaddotty-a1049e6227d412ce6bdd9065a350cb20921987e2.tar.gz
dotty-a1049e6227d412ce6bdd9065a350cb20921987e2.tar.bz2
dotty-a1049e6227d412ce6bdd9065a350cb20921987e2.zip
Split scopes into immutable and mutable parts.
The goal is that symbols should be entered/deleted directly into classes instead of their scopes. This is necesaary so that invariant about fingerPrint can be maintained. We achieve it by making the info scope have immutable type, so an explicit cast is needed to get around that.
Diffstat (limited to 'src/dotty/tools/dotc/core/pickling')
-rw-r--r--src/dotty/tools/dotc/core/pickling/ClassfileParser.scala6
-rw-r--r--src/dotty/tools/dotc/core/pickling/UnPickler.scala6
2 files changed, 6 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala b/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala
index 685ece6cb..5fbafb431 100644
--- a/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala
+++ b/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala
@@ -26,8 +26,8 @@ class ClassfileParser(
protected val staticModule: Symbol = moduleRoot.sourceModule
- protected val instanceScope: Scope = newScope // the scope of all instance definitions
- protected val staticScope: Scope = newScope // the scope of all static definitions
+ protected val instanceScope: MutableScope = newScope // the scope of all instance definitions
+ protected val staticScope: MutableScope = newScope // the scope of all static definitions
protected var pool: ConstantPool = _ // the classfile's constant pool
protected var currentClassName: Name = _ // JVM name of the current class
@@ -707,7 +707,7 @@ class ClassfileParser(
protected def getOwner(flags: Int): Symbol =
if (isStatic(flags)) moduleRoot.symbol else classRoot.symbol
- protected def getScope(flags: Int): Scope =
+ protected def getScope(flags: Int): MutableScope =
if (isStatic(flags)) staticScope else instanceScope
private def setPrivateWithin(denot: SymDenotation, jflags: Int) {
diff --git a/src/dotty/tools/dotc/core/pickling/UnPickler.scala b/src/dotty/tools/dotc/core/pickling/UnPickler.scala
index 9edc8cb84..55ed9b63d 100644
--- a/src/dotty/tools/dotc/core/pickling/UnPickler.scala
+++ b/src/dotty/tools/dotc/core/pickling/UnPickler.scala
@@ -24,7 +24,7 @@ object UnPickler {
case class TempPolyType(tparams: List[Symbol], tpe: Type) extends UncachedGroundType
/** Temporary type for classinfos, will be decomposed on completion of the class */
- case class TempClassInfoType(parentTypes: List[Type], decls: Scope, clazz: Symbol) extends UncachedGroundType
+ case class TempClassInfoType(parentTypes: List[Type], decls: MutableScope, clazz: Symbol) extends UncachedGroundType
def depoly(tp: Type)(implicit ctx: Context): Type = tp match {
case TempPolyType(tparams, restpe) => PolyType.fromSymbols(tparams, restpe)
@@ -356,7 +356,7 @@ class UnPickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleRoot: Clas
isUnpickleRoot(sym) ||
(sym is (ModuleClass | TypeParam | Scala2Existential)) ||
isRefinementClass(sym)))
- symScope(sym.owner) enter sym
+ symScope(sym.owner).openForMutations.enter(sym)
sym
}
@@ -519,7 +519,7 @@ class UnPickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleRoot: Clas
}
case CLASSINFOtpe =>
val clazz = readSymbolRef()
- TempClassInfoType(until(end, readTypeRef), symScope(clazz), clazz)
+ TempClassInfoType(until(end, readTypeRef), symScope(clazz).openForMutations, clazz)
case METHODtpe | IMPLICITMETHODtpe =>
val restpe = readTypeRef()
val params = until(end, readSymbolRef)