aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-02-07 13:53:06 +0100
committerMartin Odersky <odersky@gmail.com>2013-02-07 13:53:06 +0100
commit00cd39af75830fe1acab0f4b3b19646375ac2ea8 (patch)
tree97f863ad7053a0ebe2afabe889af98450c865c1c /src/dotty/tools/dotc/core
parent5ec4e3db6e48f8c36dff67ba262a8b41647cef5c (diff)
downloaddotty-00cd39af75830fe1acab0f4b3b19646375ac2ea8.tar.gz
dotty-00cd39af75830fe1acab0f4b3b19646375ac2ea8.tar.bz2
dotty-00cd39af75830fe1acab0f4b3b19646375ac2ea8.zip
Make superId management depend on TypeRefs instead of ClassSymbols.
Reason: Symbols may change on each run; TypeRefs do not.
Diffstat (limited to 'src/dotty/tools/dotc/core')
-rw-r--r--src/dotty/tools/dotc/core/Contexts.scala10
-rw-r--r--src/dotty/tools/dotc/core/Symbols.scala9
2 files changed, 10 insertions, 9 deletions
diff --git a/src/dotty/tools/dotc/core/Contexts.scala b/src/dotty/tools/dotc/core/Contexts.scala
index 36ac8d7af..a5cc8d493 100644
--- a/src/dotty/tools/dotc/core/Contexts.scala
+++ b/src/dotty/tools/dotc/core/Contexts.scala
@@ -149,11 +149,11 @@ object Contexts {
def nextId = { _nextId += 1; _nextId }
- /** A map from a superclass id to the class that has it */
- private[core] var classOfId = new Array[ClassSymbol](InitialSuperIdsSize)
+ /** A map from a superclass id to the type-ref of the class that has it */
+ private[core] var classOfId = new Array[TypeRef](InitialSuperIdsSize)
- /** A map from a superclass to its superclass id */
- private[core] val superIdOfClass = new mutable.HashMap[ClassSymbol, Int]
+ /** A map from a the type-ref of a superclass to its superclass id */
+ private[core] val superIdOfClass = new mutable.HashMap[TypeRef, Int]
/** The last allocate superclass id */
private[core] var lastSuperId = -1
@@ -162,7 +162,7 @@ object Contexts {
private[core] def nextSuperId: Int = {
lastSuperId += 1;
if (lastSuperId >= classOfId.length) {
- val tmp = new Array[ClassSymbol](classOfId.length * 2)
+ val tmp = new Array[TypeRef](classOfId.length * 2)
classOfId.copyToArray(tmp)
classOfId = tmp
}
diff --git a/src/dotty/tools/dotc/core/Symbols.scala b/src/dotty/tools/dotc/core/Symbols.scala
index 348fc4848..c345128b3 100644
--- a/src/dotty/tools/dotc/core/Symbols.scala
+++ b/src/dotty/tools/dotc/core/Symbols.scala
@@ -185,15 +185,16 @@ object Symbols {
def superId(implicit ctx: Context): Int = {
val hint = superIdHint
- if (hint >= 0 && hint <= ctx.lastSuperId && (ctx.classOfId(hint) eq this)) hint
+ val key = this.typeConstructor
+ if (hint >= 0 && hint <= ctx.lastSuperId && (ctx.classOfId(hint) eq key)) hint
else {
- val id = ctx.superIdOfClass get this match {
+ val id = ctx.superIdOfClass get key match {
case Some(id) =>
id
case None =>
val id = ctx.nextSuperId
- ctx.superIdOfClass(this) = id
- ctx.classOfId(id) = this
+ ctx.superIdOfClass(key) = id
+ ctx.classOfId(id) = key
id
}
superIdHint = id