JVM IR: Fix test for anonymous object constructors in FunctionCodegen
This commit is contained in:
committed by
Alexander Udalov
parent
6560ecc82b
commit
bdd5705a30
+2
-3
@@ -49,8 +49,7 @@ open class FunctionCodegen(
|
|||||||
val flags = calculateMethodFlags(functionView.isStatic)
|
val flags = calculateMethodFlags(functionView.isStatic)
|
||||||
var methodVisitor = createMethod(flags, signature)
|
var methodVisitor = createMethod(flags, signature)
|
||||||
|
|
||||||
val hasSyntheticFlag = flags.and(Opcodes.ACC_SYNTHETIC) != 0
|
if (state.generateParametersMetadata && flags.and(Opcodes.ACC_SYNTHETIC) == 0) {
|
||||||
if (state.generateParametersMetadata && !hasSyntheticFlag) {
|
|
||||||
generateParameterNames(irFunction, methodVisitor, signature, state)
|
generateParameterNames(irFunction, methodVisitor, signature, state)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +64,7 @@ open class FunctionCodegen(
|
|||||||
// super constructor arguments, there shouldn't be any annotations on them other than @NonNull,
|
// super constructor arguments, there shouldn't be any annotations on them other than @NonNull,
|
||||||
// and those are meaningless on synthetic parameters. (Also, the inliner cannot handle them and
|
// and those are meaningless on synthetic parameters. (Also, the inliner cannot handle them and
|
||||||
// will throw an exception if we generate any.)
|
// will throw an exception if we generate any.)
|
||||||
if (irFunction !is IrConstructor || (!hasSyntheticFlag && !irFunction.parentAsClass.isAnonymousObject)) {
|
if (irFunction !is IrConstructor || !irFunction.parentAsClass.isAnonymousObject) {
|
||||||
generateParameterAnnotations(functionView, methodVisitor, signature, classCodegen, context)
|
generateParameterAnnotations(functionView, methodVisitor, signature, classCodegen, context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -38,6 +38,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
|
|||||||
import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid
|
import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid
|
||||||
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
|
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
|
import org.jetbrains.kotlin.name.SpecialNames
|
||||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||||
|
|
||||||
internal val callableReferencePhase = makeIrFilePhase(
|
internal val callableReferencePhase = makeIrFilePhase(
|
||||||
@@ -175,7 +176,7 @@ internal class CallableReferenceLowering(private val context: JvmBackendContext)
|
|||||||
// A callable reference results in a synthetic class, while a lambda is not synthetic.
|
// A callable reference results in a synthetic class, while a lambda is not synthetic.
|
||||||
// We don't produce GENERATED_SAM_IMPLEMENTATION, which is always synthetic.
|
// We don't produce GENERATED_SAM_IMPLEMENTATION, which is always synthetic.
|
||||||
origin = if (isLambda) JvmLoweredDeclarationOrigin.LAMBDA_IMPL else JvmLoweredDeclarationOrigin.FUNCTION_REFERENCE_IMPL
|
origin = if (isLambda) JvmLoweredDeclarationOrigin.LAMBDA_IMPL else JvmLoweredDeclarationOrigin.FUNCTION_REFERENCE_IMPL
|
||||||
name = Name.special("<function reference to ${callee.fqNameWhenAvailable}>")
|
name = SpecialNames.NO_NAME_PROVIDED
|
||||||
}.apply {
|
}.apply {
|
||||||
parent = currentDeclarationParent
|
parent = currentDeclarationParent
|
||||||
superTypes += superType
|
superTypes += superType
|
||||||
|
|||||||
+2
-1
@@ -33,6 +33,7 @@ import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
|
|||||||
import org.jetbrains.kotlin.load.java.JavaVisibilities
|
import org.jetbrains.kotlin.load.java.JavaVisibilities
|
||||||
import org.jetbrains.kotlin.load.java.JvmAbi
|
import org.jetbrains.kotlin.load.java.JvmAbi
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
|
import org.jetbrains.kotlin.name.SpecialNames
|
||||||
import org.jetbrains.kotlin.types.Variance
|
import org.jetbrains.kotlin.types.Variance
|
||||||
|
|
||||||
internal val propertyReferencePhase = makeIrFilePhase(
|
internal val propertyReferencePhase = makeIrFilePhase(
|
||||||
@@ -227,7 +228,7 @@ internal class PropertyReferenceLowering(val context: JvmBackendContext) : Class
|
|||||||
val superClass = propertyReferenceKindFor(expression).interfaceSymbol.owner
|
val superClass = propertyReferenceKindFor(expression).interfaceSymbol.owner
|
||||||
val referenceClass = buildClass {
|
val referenceClass = buildClass {
|
||||||
setSourceRange(expression)
|
setSourceRange(expression)
|
||||||
name = Name.special("<property reference to ${(expression.symbol.owner as IrDeclarationWithName).fqNameWhenAvailable}>")
|
name = SpecialNames.NO_NAME_PROVIDED
|
||||||
origin = JvmLoweredDeclarationOrigin.GENERATED_PROPERTY_REFERENCE
|
origin = JvmLoweredDeclarationOrigin.GENERATED_PROPERTY_REFERENCE
|
||||||
visibility = Visibilities.LOCAL
|
visibility = Visibilities.LOCAL
|
||||||
}.apply {
|
}.apply {
|
||||||
|
|||||||
Reference in New Issue
Block a user