diff options
author | schinz <schinz@epfl.ch> | 2005-03-26 14:12:37 +0000 |
---|---|---|
committer | schinz <schinz@epfl.ch> | 2005-03-26 14:12:37 +0000 |
commit | 9917c668018f845f55e09f74323509791063a463 (patch) | |
tree | 5a42db2d954eb31dd5f0531f4f742661eb7c1e8d /sources | |
parent | 22d6d7b6529d25be5d0586eeb5efc1bd305e3ff7 (diff) | |
download | scala-9917c668018f845f55e09f74323509791063a463.tar.gz scala-9917c668018f845f55e09f74323509791063a463.tar.bz2 scala-9917c668018f845f55e09f74323509791063a463.zip |
- pass null as ancestor code when it is empty, ...
- pass null as ancestor code when it is empty, instead of creating an
array each time
Diffstat (limited to 'sources')
-rw-r--r-- | sources/scala/runtime/types/TypeConstructor.java | 5 | ||||
-rw-r--r-- | sources/scalac/transformer/TypesAsValuesPhase.java | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/sources/scala/runtime/types/TypeConstructor.java b/sources/scala/runtime/types/TypeConstructor.java index 50029ed49d..6973050105 100644 --- a/sources/scala/runtime/types/TypeConstructor.java +++ b/sources/scala/runtime/types/TypeConstructor.java @@ -78,6 +78,8 @@ public class TypeConstructor implements java.io.Serializable { private static final ClassLoader loader = ClassLoader.getSystemClassLoader(); + private static final int[] EMPTY_ANCESTOR_CODE = new int[0]; + public TypeConstructor(int level, String fullName, Object outer, @@ -93,7 +95,8 @@ public class TypeConstructor implements java.io.Serializable { this.pCount = pCount; this.ancestorCacheDepth = ancestorCacheDepth; - this.ancestorCode = ancestorCode; + this.ancestorCode = + (ancestorCode == null ? EMPTY_ANCESTOR_CODE : ancestorCode); this.isTrivial = (outer == null) && (zCount + pCount + mCount == 0); this.isStronglyTrivial = (ancestorCacheDepth == 0); diff --git a/sources/scalac/transformer/TypesAsValuesPhase.java b/sources/scalac/transformer/TypesAsValuesPhase.java index 6eea866c11..11dcaa2487 100644 --- a/sources/scalac/transformer/TypesAsValuesPhase.java +++ b/sources/scalac/transformer/TypesAsValuesPhase.java @@ -588,6 +588,7 @@ public class TypesAsValuesPhase extends Phase { } Ancestor[][] ancestors = computeAncestors(clsSym); + int[] ancestorCode = getAncestorCode(ancestors); Tree outer = isNestedClass(clsSym) ? (clsSym.owner().isClass() @@ -603,7 +604,9 @@ public class TypesAsValuesPhase extends Phase { gen.mkIntLit(pos, mCount), gen.mkIntLit(pos, pCount), gen.mkIntLit(pos, ancestors.length), - mkNewIntLitArray(pos, getAncestorCode(ancestors), owner) + ancestorCode.length == 0 + ? gen.mkNullLit(pos) + : mkNewIntLitArray(pos, getAncestorCode(ancestors), owner) }; Symbol tcConst = defs.TYPECONSTRUCTOR_CLASS.primaryConstructor(); |