[JVM IR] Move CachedSyntheticDeclarations to backend.common

This will allow us to use this class in KLIB-based backends (KT-64865)
This commit is contained in:
Sergej Jaskiewicz
2024-02-02 21:47:54 +01:00
committed by Space Team
parent 25be39dcc6
commit 919abe483a
2 changed files with 5 additions and 4 deletions
@@ -1,9 +1,9 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2024 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.
*/
package org.jetbrains.kotlin.backend.jvm
package org.jetbrains.kotlin.backend.common.lower.inline
import org.jetbrains.kotlin.backend.common.BackendContext
import org.jetbrains.kotlin.backend.common.ScopeWithIr
@@ -33,7 +33,7 @@ import java.util.concurrent.ConcurrentHashMap
* accessors on KLIB-based backends ([KT-64865](https://youtrack.jetbrains.com/issue/KT-64865)).
* Please consider this fact when you want to change its implementation.
*/
open class CachedSyntheticDeclarations<Context : BackendContext>(protected val context: Context) {
open class SyntheticAccessorGenerator<Context : BackendContext>(protected val context: Context) {
private data class FieldKey(val fieldSymbol: IrFieldSymbol, val parent: IrDeclarationParent, val superQualifierSymbol: IrClassSymbol?)
private data class FunctionKey(
@@ -6,6 +6,7 @@
package org.jetbrains.kotlin.backend.jvm
import org.jetbrains.kotlin.backend.common.ScopeWithIr
import org.jetbrains.kotlin.backend.common.lower.inline.SyntheticAccessorGenerator
import org.jetbrains.kotlin.backend.jvm.ir.isJvmInterface
import org.jetbrains.kotlin.codegen.AsmUtil
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
@@ -19,7 +20,7 @@ import org.jetbrains.kotlin.load.java.JvmAbi
import org.jetbrains.org.objectweb.asm.Opcodes
import java.util.concurrent.ConcurrentHashMap
class JvmSyntheticAccessorGenerator(context: JvmBackendContext) : CachedSyntheticDeclarations<JvmBackendContext>(context) {
class JvmSyntheticAccessorGenerator(context: JvmBackendContext) : SyntheticAccessorGenerator<JvmBackendContext>(context) {
override fun accessorModality(parent: IrDeclarationParent): Modality =
if (parent is IrClass && parent.isJvmInterface) Modality.OPEN else Modality.FINAL