[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:
committed by
Space Team
parent
25be39dcc6
commit
919abe483a
+3
-3
@@ -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.
|
* 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.BackendContext
|
||||||
import org.jetbrains.kotlin.backend.common.ScopeWithIr
|
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)).
|
* 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.
|
* 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 FieldKey(val fieldSymbol: IrFieldSymbol, val parent: IrDeclarationParent, val superQualifierSymbol: IrClassSymbol?)
|
||||||
|
|
||||||
private data class FunctionKey(
|
private data class FunctionKey(
|
||||||
+2
-1
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.backend.jvm
|
package org.jetbrains.kotlin.backend.jvm
|
||||||
|
|
||||||
import org.jetbrains.kotlin.backend.common.ScopeWithIr
|
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.backend.jvm.ir.isJvmInterface
|
||||||
import org.jetbrains.kotlin.codegen.AsmUtil
|
import org.jetbrains.kotlin.codegen.AsmUtil
|
||||||
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
|
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 org.jetbrains.org.objectweb.asm.Opcodes
|
||||||
import java.util.concurrent.ConcurrentHashMap
|
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 =
|
override fun accessorModality(parent: IrDeclarationParent): Modality =
|
||||||
if (parent is IrClass && parent.isJvmInterface) Modality.OPEN else Modality.FINAL
|
if (parent is IrClass && parent.isJvmInterface) Modality.OPEN else Modality.FINAL
|
||||||
|
|||||||
Reference in New Issue
Block a user