org.jetbrains.kotlin.fir.java.FirSyntheticPropertiesStorage.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.java
import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.FirSessionComponent
import org.jetbrains.kotlin.fir.caches.FirCache
import org.jetbrains.kotlin.fir.caches.createCache
import org.jetbrains.kotlin.fir.caches.firCachesFactory
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
import org.jetbrains.kotlin.fir.java.scopes.JavaClassUseSiteMemberScope
import org.jetbrains.kotlin.fir.scopes.impl.FirTypeIntersectionScopeContext.ResultOfIntersection
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirSyntheticPropertySymbol
import org.jetbrains.kotlin.fir.types.ConeKotlinType
import org.jetbrains.kotlin.name.Name
data class SyntheticPropertiesCacheKey(
val name: Name,
val receiverParameterType: ConeKotlinType?,
val contextReceiverTypes: List
)
typealias SyntheticPropertiesCache = FirCache>>
class FirSyntheticPropertiesStorage(session: FirSession) : FirSessionComponent {
private val cachesFactory = session.firCachesFactory
val cacheByOwner: FirCache =
cachesFactory.createCache { _ ->
cachesFactory.createCache { _, (scope, intersection) ->
scope.syntheticPropertyFromOverride(intersection)
}
}
}
val FirSession.syntheticPropertiesStorage: FirSyntheticPropertiesStorage by FirSession.sessionComponentAccessor()