org.jetbrains.kotlin.fir.declarations.ExpectActualAttributes.kt Maven / Gradle / Ivy
/*
* Copyright 2010-2022 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.declarations
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
import org.jetbrains.kotlin.fir.symbols.SymbolInternals
import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol
import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase
import org.jetbrains.kotlin.resolve.multiplatform.ExpectActualCompatibility
private object ExpectForActualAttributeKey : FirDeclarationDataKey()
typealias ExpectForActualData = Map>, List>>
@SymbolInternals
var FirDeclaration.expectForActual: ExpectForActualData? by FirDeclarationDataRegistry.data(ExpectForActualAttributeKey)
fun FirFunctionSymbol<*>.getSingleExpectForActualOrNull(): FirFunctionSymbol<*>? =
(this as FirBasedSymbol<*>).getSingleExpectForActualOrNull() as? FirFunctionSymbol<*>
fun FirBasedSymbol<*>.getSingleExpectForActualOrNull(): FirBasedSymbol<*>? {
return expectForActual?.values?.singleOrNull()?.singleOrNull()
}
val FirBasedSymbol<*>.expectForActual: ExpectForActualData?
get() {
lazyResolveToPhase(FirResolvePhase.EXPECT_ACTUAL_MATCHING)
return fir.expectForActual
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy