JVM_IR: Add attributes to named suspend functions
This is a prerequisite to moving continuation classes inside said functions, which is needed to support crossinline suspend lambdas. The logic of whether to copy attributes on lowerings or not is simple: - if the lowering moves function body to a new place, it should copy the attributes. - if the lowering just generates new declarations (i.e. bridges), it should leave attributes as is.
This commit is contained in:
@@ -493,6 +493,7 @@ fun IrClass.addFakeOverrides() {
|
||||
parent = this@addFakeOverrides
|
||||
overriddenSymbols += overriddenFunctions.map { it.symbol }
|
||||
copyParameterDeclarationsFrom(irFunction)
|
||||
copyAttributes(irFunction)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-2
@@ -6,7 +6,7 @@
|
||||
package org.jetbrains.kotlin.backend.common.lower
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.*
|
||||
import org.jetbrains.kotlin.backend.common.descriptors.*
|
||||
import org.jetbrains.kotlin.backend.common.descriptors.synthesizedString
|
||||
import org.jetbrains.kotlin.backend.common.ir.*
|
||||
import org.jetbrains.kotlin.descriptors.Modality
|
||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||
@@ -22,7 +22,10 @@ import org.jetbrains.kotlin.ir.expressions.impl.*
|
||||
import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
|
||||
import org.jetbrains.kotlin.ir.types.*
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.types.defaultType
|
||||
import org.jetbrains.kotlin.ir.types.isNullable
|
||||
import org.jetbrains.kotlin.ir.types.makeNullable
|
||||
import org.jetbrains.kotlin.ir.util.*
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
|
||||
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
|
||||
|
||||
+2
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@@ -543,6 +543,7 @@ class LocalDeclarationsLowering(
|
||||
newParameterToOld.putAbsentOrSame(it, this)
|
||||
}
|
||||
}
|
||||
newDeclaration.copyAttributes(oldDeclaration)
|
||||
|
||||
newDeclaration.valueParameters += createTransformedValueParameters(capturedValues, oldDeclaration, newDeclaration)
|
||||
newDeclaration.recordTransformedValueParameters(localFunctionContext)
|
||||
|
||||
Reference in New Issue
Block a user