From 41c884462cb017398573a19412e987991f15a232 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 22 Jan 2013 14:31:50 +0100 Subject: Made classOfId grow to match superId range. --- src/dotty/tools/dotc/core/Contexts.scala | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/dotty/tools/dotc/core') diff --git a/src/dotty/tools/dotc/core/Contexts.scala b/src/dotty/tools/dotc/core/Contexts.scala index 131f72c65..74b6e851f 100644 --- a/src/dotty/tools/dotc/core/Contexts.scala +++ b/src/dotty/tools/dotc/core/Contexts.scala @@ -55,7 +55,7 @@ object Contexts { // Symbols state /** A map from a superclass id to the class that has it */ - private[core] var classOfId = Array.ofDim[ClassSymbol](InitialSuperIdsSize) + private[core] var classOfId = new Array[ClassSymbol](InitialSuperIdsSize) /** A map from a superclass to its superclass id */ private[core] val superIdOfClass = new mutable.HashMap[ClassSymbol, Int] @@ -64,7 +64,15 @@ object Contexts { private[core] var lastSuperId = -1 /** Allocate and return next free superclass id */ - private[core] def nextSuperId: Int = { lastSuperId += 1; lastSuperId } + private[core] def nextSuperId: Int = { + lastSuperId += 1; + if (lastSuperId >= classOfId.length) { + val tmp = new Array[ClassSymbol](classOfId.length * 2) + classOfId.copyToArray(tmp) + classOfId = tmp + } + lastSuperId + } // SymDenotations state private[core] val uniqueBits = new util.HashSet[BitSet]("superbits", 1024) -- cgit v1.2.3