Remove descriptor usage from Scope.kt

This commit is contained in:
Georgy Bronnikov
2020-10-16 14:36:27 +03:00
parent 8d999a2c13
commit e5cf7a1be7
6 changed files with 18 additions and 132 deletions
@@ -331,7 +331,7 @@ open class SerializerIrGenerator(
}
// returns null: Any? for boxed types and 0: <number type> for primitives
private fun IrBuilderWithScope.defaultValueAndType(prop: SerializableProperty): Pair<IrExpression, KotlinType> {
private fun IrBuilderWithScope.defaultValueAndType(prop: SerializableProperty): Pair<IrExpression, IrType> {
val kType = prop.descriptor.returnType!!
val T = kType.toIrType()
val defaultPrimitive: IrExpression? = when {
@@ -346,9 +346,9 @@ open class SerializerIrGenerator(
else -> null
}
return if (defaultPrimitive == null)
irNull(compilerContext.irBuiltIns.anyNType) to (compilerContext.builtIns.nullableAnyType)
irNull(compilerContext.irBuiltIns.anyNType) to (compilerContext.irBuiltIns.anyNType)
else
defaultPrimitive to kType
defaultPrimitive to T
}
override fun generateLoad(function: FunctionDescriptor) = irClass.contributeFunction(function) { loadFunc ->
@@ -382,7 +382,7 @@ open class SerializerIrGenerator(
irTemporaryVar(
expr,
"local$i",
typeHint = type
type
)
}