Fix RTTI bugs. (#105)
This commit is contained in:
+7
-2
@@ -10,7 +10,11 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.*
|
||||
internal val ClassDescriptor.implementedInterfaces: List<ClassDescriptor>
|
||||
get() {
|
||||
val superClassImplementedInterfaces = this.getSuperClassNotAny()?.implementedInterfaces ?: emptyList()
|
||||
return (superClassImplementedInterfaces + this.getSuperInterfaces()).distinctBy { it.classId }
|
||||
val superInterfaces = this.getSuperInterfaces()
|
||||
val superInterfacesImplementedInterfaces = superInterfaces.flatMap { it.implementedInterfaces }
|
||||
return (superClassImplementedInterfaces +
|
||||
superInterfacesImplementedInterfaces +
|
||||
superInterfaces).distinctBy { it.classId }
|
||||
}
|
||||
|
||||
|
||||
@@ -62,6 +66,7 @@ internal val ClassDescriptor.isArray: Boolean
|
||||
internal val ClassDescriptor.isInterface: Boolean
|
||||
get() = (this.kind == ClassKind.INTERFACE)
|
||||
|
||||
|
||||
internal val CallableDescriptor.allValueParameters: List<ParameterDescriptor>
|
||||
get() {
|
||||
val constructorReceiver = if (this is ConstructorDescriptor) {
|
||||
@@ -76,4 +81,4 @@ internal val CallableDescriptor.allValueParameters: List<ParameterDescriptor>
|
||||
this.extensionReceiverParameter).filterNotNull()
|
||||
|
||||
return receivers + this.valueParameters
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -149,9 +149,9 @@ internal class RTTIGenerator(override val context: Context) : ContextUtils {
|
||||
|
||||
val size = getInstanceSize(classType, className)
|
||||
|
||||
val superTypeOrNull = classDesc.getSuperClassNotAny()
|
||||
val superType = if (superTypeOrNull != null) superTypeOrNull.llvmTypeInfoPtr
|
||||
else NullPointer(runtime.typeInfoType)
|
||||
val superTypeOrAny = classDesc.getSuperClassOrAny()
|
||||
val superType = if (KotlinBuiltIns.isAny(classDesc)) NullPointer(runtime.typeInfoType)
|
||||
else superTypeOrAny.llvmTypeInfoPtr
|
||||
|
||||
val interfaces = classDesc.implementedInterfaces.map { it.llvmTypeInfoPtr }
|
||||
val interfacesPtr = staticData.placeGlobalConstArray("kintf:$className",
|
||||
|
||||
@@ -151,7 +151,7 @@ class ArrayList<E> private constructor(
|
||||
override fun equals(other: Any?): Boolean {
|
||||
//TODO: rethink instance checks, shall it be other is List<*>?
|
||||
return other === this ||
|
||||
(other is ArrayList<*>) && contentEquals(other)
|
||||
(other is List<*>) && contentEquals(other)
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
|
||||
Reference in New Issue
Block a user