org.jetbrains.kotlin.fir.backend.Fir2IrCommonMemberStorage.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-compiler-embeddable Show documentation
Show all versions of kotlin-compiler-embeddable Show documentation
the Kotlin compiler embeddable
/*
* Copyright 2010-2023 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.fir.backend
import org.jetbrains.kotlin.fir.backend.Fir2IrDeclarationStorage.PropertyCacheStorage.SyntheticPropertyKey
import org.jetbrains.kotlin.fir.declarations.*
import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag
import org.jetbrains.kotlin.ir.IrLock
import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
import org.jetbrains.kotlin.ir.declarations.IrTypeParameter
import org.jetbrains.kotlin.ir.symbols.*
import java.util.concurrent.ConcurrentHashMap
/**
* This storage contains the shared state of FIR2IR.
*
* State is shared between the conversions of different modules in the same platform compilation.
*
* See `/docs/fir/k2_kmp.md`
*/
class Fir2IrCommonMemberStorage {
val lock: IrLock = IrLock()
val classCache: MutableMap = mutableMapOf()
val notFoundClassCache: ConcurrentHashMap = ConcurrentHashMap()
val typeParameterCache: MutableMap = mutableMapOf()
val enumEntryCache: MutableMap = mutableMapOf()
val localClassCache: MutableMap = mutableMapOf()
val functionCache: ConcurrentHashMap = ConcurrentHashMap()
val dataClassGeneratedFunctionsCache: ConcurrentHashMap =
ConcurrentHashMap()
val constructorCache: ConcurrentHashMap = ConcurrentHashMap()
val propertyCache: ConcurrentHashMap = ConcurrentHashMap()
val syntheticPropertyCache: ConcurrentHashMap = ConcurrentHashMap()
val getterForPropertyCache: ConcurrentHashMap = ConcurrentHashMap()
val setterForPropertyCache: ConcurrentHashMap = ConcurrentHashMap()
val backingFieldForPropertyCache: ConcurrentHashMap = ConcurrentHashMap()
val propertyForBackingFieldCache: ConcurrentHashMap = ConcurrentHashMap()
val delegateVariableForPropertyCache: ConcurrentHashMap = ConcurrentHashMap()
val irForFirSessionDependantDeclarationMap: MutableMap = mutableMapOf()
/**
* This map contains information about classes, which implement interfaces by delegation
*
* ```
* class Some(val a: A, b: B) : A by a, B by b
* ```
*
* delegatedClassesMap = {
* Some -> {
* A -> backingField of val a,
* B -> field for delegate b
* }
* }
*/
val delegatedClassesInfo: MutableMap> = mutableMapOf()
val firClassesWithInheritanceByDelegation: MutableSet = mutableSetOf()
/**
* Contains information about synthetic methods generated for data and value classes
* It will be used to generate bodies of those methods after fir2ir conversion is over
*/
val generatedDataValueClassSyntheticFunctions: MutableMap = mutableMapOf()
data class DataValueClassGeneratedMembersInfo(
val components: Fir2IrComponents,
val firClass: FirRegularClass,
val origin: IrDeclarationOrigin,
val generatedFunctions: MutableList
)
}