JVM IR: Don't generate line numbers and null checks in SAM wrapper constructors

This commit is contained in:
Steven Schäfer
2020-11-02 14:40:08 +01:00
committed by Alexander Udalov
parent 68e2d0d245
commit 8574cb4466
7 changed files with 61 additions and 5 deletions
@@ -69,6 +69,10 @@ abstract class SingleAbstractMethodLowering(val context: CommonBackendContext) :
protected open fun getWrappedFunctionType(klass: IrClass): IrType =
klass.defaultType
protected open fun IrFunctionBuilder.setConstructorSourceRange(createFor: IrElement) {
setSourceRange(createFor)
}
abstract val IrType.needEqualsHashCodeMethods: Boolean
open val inInlineFunctionScope get() = allScopes.any { scope -> (scope.irElement as? IrFunction)?.isInline ?: false }
@@ -187,10 +191,10 @@ abstract class SingleAbstractMethodLowering(val context: CommonBackendContext) :
}
subclass.addConstructor {
origin = subclass.origin
origin = IrDeclarationOrigin.GENERATED_SAM_IMPLEMENTATION
isPrimary = true
visibility = wrapperVisibility
setSourceRange(createFor)
setConstructorSourceRange(createFor)
}.apply {
val parameter = addValueParameter {
name = field.name