[FIR2IR] Remove linkViaSignatures from Fir2IrConfiguration
^KT-64809 Fixed
This commit is contained in:
committed by
Space Team
parent
e8aa05928d
commit
8b4cc050eb
+1
-1
@@ -267,7 +267,7 @@ internal class KtFirCompilerFacility(
|
|||||||
fir2IrExtensions,
|
fir2IrExtensions,
|
||||||
fir2IrConfiguration,
|
fir2IrConfiguration,
|
||||||
irGeneratorExtensions,
|
irGeneratorExtensions,
|
||||||
signatureComposerForJvmFir2Ir(fir2IrConfiguration.linkViaSignatures),
|
signatureComposerForJvmFir2Ir(),
|
||||||
JvmIrMangler,
|
JvmIrMangler,
|
||||||
FirJvmKotlinMangler(),
|
FirJvmKotlinMangler(),
|
||||||
FirJvmVisibilityConverter,
|
FirJvmVisibilityConverter,
|
||||||
|
|||||||
@@ -38,11 +38,9 @@ import org.jetbrains.kotlin.cli.jvm.modules.CliJavaModuleResolver
|
|||||||
import org.jetbrains.kotlin.codegen.ClassBuilderFactories
|
import org.jetbrains.kotlin.codegen.ClassBuilderFactories
|
||||||
import org.jetbrains.kotlin.codegen.CodegenFactory
|
import org.jetbrains.kotlin.codegen.CodegenFactory
|
||||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||||
import org.jetbrains.kotlin.config.CommonConfigurationKeys
|
|
||||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||||
import org.jetbrains.kotlin.config.JVMConfigurationKeys
|
import org.jetbrains.kotlin.config.JVMConfigurationKeys
|
||||||
import org.jetbrains.kotlin.config.languageVersionSettings
|
import org.jetbrains.kotlin.config.languageVersionSettings
|
||||||
import org.jetbrains.kotlin.constant.EvaluatedConstTracker
|
|
||||||
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
|
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
|
||||||
import org.jetbrains.kotlin.diagnostics.impl.BaseDiagnosticsCollector
|
import org.jetbrains.kotlin.diagnostics.impl.BaseDiagnosticsCollector
|
||||||
import org.jetbrains.kotlin.fir.backend.Fir2IrConfiguration
|
import org.jetbrains.kotlin.fir.backend.Fir2IrConfiguration
|
||||||
@@ -205,7 +203,7 @@ fun FirResult.convertToIrAndActualizeForJvm(
|
|||||||
fir2IrExtensions,
|
fir2IrExtensions,
|
||||||
fir2IrConfiguration,
|
fir2IrConfiguration,
|
||||||
irGeneratorExtensions,
|
irGeneratorExtensions,
|
||||||
signatureComposerForJvmFir2Ir(fir2IrConfiguration.linkViaSignatures),
|
signatureComposerForJvmFir2Ir(),
|
||||||
JvmIrMangler,
|
JvmIrMangler,
|
||||||
FirJvmKotlinMangler(),
|
FirJvmKotlinMangler(),
|
||||||
FirJvmVisibilityConverter,
|
FirJvmVisibilityConverter,
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import org.jetbrains.kotlin.backend.common.actualizer.SpecialFakeOverrideSymbols
|
|||||||
import org.jetbrains.kotlin.backend.common.actualizer.SpecialFakeOverrideSymbolsResolverVisitor
|
import org.jetbrains.kotlin.backend.common.actualizer.SpecialFakeOverrideSymbolsResolverVisitor
|
||||||
import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
|
import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
|
||||||
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
|
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
|
||||||
import org.jetbrains.kotlin.backend.jvm.serialization.JvmIdSignatureDescriptor
|
|
||||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||||
import org.jetbrains.kotlin.fir.FirSession
|
import org.jetbrains.kotlin.fir.FirSession
|
||||||
import org.jetbrains.kotlin.fir.backend.*
|
import org.jetbrains.kotlin.fir.backend.*
|
||||||
@@ -44,13 +43,9 @@ data class Fir2IrActualizedResult(
|
|||||||
val irActualizedResult: IrActualizedResult?,
|
val irActualizedResult: IrActualizedResult?,
|
||||||
)
|
)
|
||||||
|
|
||||||
fun signatureComposerForJvmFir2Ir(generateSignatures: Boolean): IdSignatureComposer {
|
fun signatureComposerForJvmFir2Ir(): IdSignatureComposer {
|
||||||
val mangler = JvmDescriptorMangler(null)
|
val mangler = JvmDescriptorMangler(null)
|
||||||
return if (generateSignatures) {
|
return DescriptorSignatureComposerStub(mangler)
|
||||||
JvmIdSignatureDescriptor(mangler)
|
|
||||||
} else {
|
|
||||||
DescriptorSignatureComposerStub(mangler)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun FirResult.convertToIrAndActualize(
|
fun FirResult.convertToIrAndActualize(
|
||||||
|
|||||||
+2
-11
@@ -9,7 +9,6 @@ import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
|
|||||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||||
import org.jetbrains.kotlin.descriptors.Visibility
|
import org.jetbrains.kotlin.descriptors.Visibility
|
||||||
import org.jetbrains.kotlin.fir.declarations.*
|
import org.jetbrains.kotlin.fir.declarations.*
|
||||||
import org.jetbrains.kotlin.fir.declarations.utils.isLocal
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.utils.visibility
|
import org.jetbrains.kotlin.fir.declarations.utils.visibility
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirAnonymousObjectExpression
|
import org.jetbrains.kotlin.fir.expressions.FirAnonymousObjectExpression
|
||||||
import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider
|
import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider
|
||||||
@@ -27,7 +26,6 @@ import org.jetbrains.kotlin.ir.types.IrType
|
|||||||
import org.jetbrains.kotlin.ir.util.IdSignature
|
import org.jetbrains.kotlin.ir.util.IdSignature
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.name.SpecialNames
|
import org.jetbrains.kotlin.name.SpecialNames
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.runIf
|
|
||||||
|
|
||||||
class Fir2IrClassifierStorage(
|
class Fir2IrClassifierStorage(
|
||||||
private val components: Fir2IrComponents,
|
private val components: Fir2IrComponents,
|
||||||
@@ -177,20 +175,13 @@ class Fir2IrClassifierStorage(
|
|||||||
parent: IrDeclarationParent,
|
parent: IrDeclarationParent,
|
||||||
predefinedOrigin: IrDeclarationOrigin? = null
|
predefinedOrigin: IrDeclarationOrigin? = null
|
||||||
): IrClass {
|
): IrClass {
|
||||||
val symbol = createClassSymbol(regularClass)
|
val symbol = createClassSymbol(signature = null)
|
||||||
return classifiersGenerator.createIrClass(regularClass, parent, symbol, predefinedOrigin).also {
|
return classifiersGenerator.createIrClass(regularClass, parent, symbol, predefinedOrigin).also {
|
||||||
@OptIn(LeakedDeclarationCaches::class)
|
@OptIn(LeakedDeclarationCaches::class)
|
||||||
cacheIrClass(regularClass, it)
|
cacheIrClass(regularClass, it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createClassSymbol(regularClass: FirRegularClass): IrClassSymbol {
|
|
||||||
val signature = runIf(!regularClass.isLocal && configuration.linkViaSignatures) {
|
|
||||||
signatureComposer.composeSignature(regularClass)
|
|
||||||
}
|
|
||||||
return createClassSymbol(signature)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun createClassSymbol(signature: IdSignature?): IrClassSymbol {
|
private fun createClassSymbol(signature: IdSignature?): IrClassSymbol {
|
||||||
return when {
|
return when {
|
||||||
signature != null -> symbolTable.referenceClass(signature)
|
signature != null -> symbolTable.referenceClass(signature)
|
||||||
@@ -247,7 +238,7 @@ class Fir2IrClassifierStorage(
|
|||||||
// firClass may be referenced by some parent's type parameters as a bound. In that case, getIrClassSymbol will be called recursively.
|
// firClass may be referenced by some parent's type parameters as a bound. In that case, getIrClassSymbol will be called recursively.
|
||||||
classifierStorage.getCachedIrClass(firClass)?.let { return it }
|
classifierStorage.getCachedIrClass(firClass)?.let { return it }
|
||||||
|
|
||||||
val symbol = createClassSymbol(firClass)
|
val symbol = createClassSymbol(signature = null)
|
||||||
val irClass = lazyDeclarationsGenerator.createIrLazyClass(firClass, irParent, symbol)
|
val irClass = lazyDeclarationsGenerator.createIrLazyClass(firClass, irParent, symbol)
|
||||||
classCache[firClass] = irClass
|
classCache[firClass] = irClass
|
||||||
// NB: this is needed to prevent recursions in case of self bounds
|
// NB: this is needed to prevent recursions in case of self bounds
|
||||||
|
|||||||
@@ -24,10 +24,6 @@ import org.jetbrains.kotlin.incremental.components.InlineConstTracker
|
|||||||
import org.jetbrains.kotlin.ir.util.SymbolTable
|
import org.jetbrains.kotlin.ir.util.SymbolTable
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param linkViaSignatures Enables calculation of signatures for IR symbols and filling the [SymbolTable] with them.
|
|
||||||
* This parameter should be set to `true` if the caller relies on the content of the symbol table in the future.
|
|
||||||
* Note: this parameter is to be removed ([KT-64809](https://youtrack.jetbrains.com/issue/KT-64809)).
|
|
||||||
*
|
|
||||||
* @param allowNonCachedDeclarations
|
* @param allowNonCachedDeclarations
|
||||||
* Normally, FIR2IR caches all declarations it meets in a compiled module.
|
* Normally, FIR2IR caches all declarations it meets in a compiled module.
|
||||||
* It means asking for an IR element of a non-cached declaration is a sign of inconsistent state.
|
* It means asking for an IR element of a non-cached declaration is a sign of inconsistent state.
|
||||||
@@ -40,7 +36,6 @@ import org.jetbrains.kotlin.ir.util.SymbolTable
|
|||||||
class Fir2IrConfiguration private constructor(
|
class Fir2IrConfiguration private constructor(
|
||||||
val languageVersionSettings: LanguageVersionSettings,
|
val languageVersionSettings: LanguageVersionSettings,
|
||||||
val diagnosticReporter: DiagnosticReporter,
|
val diagnosticReporter: DiagnosticReporter,
|
||||||
val linkViaSignatures: Boolean,
|
|
||||||
val evaluatedConstTracker: EvaluatedConstTracker,
|
val evaluatedConstTracker: EvaluatedConstTracker,
|
||||||
val inlineConstTracker: InlineConstTracker?,
|
val inlineConstTracker: InlineConstTracker?,
|
||||||
val expectActualTracker: ExpectActualTracker?,
|
val expectActualTracker: ExpectActualTracker?,
|
||||||
@@ -56,7 +51,6 @@ class Fir2IrConfiguration private constructor(
|
|||||||
Fir2IrConfiguration(
|
Fir2IrConfiguration(
|
||||||
languageVersionSettings = compilerConfiguration.languageVersionSettings,
|
languageVersionSettings = compilerConfiguration.languageVersionSettings,
|
||||||
diagnosticReporter = diagnosticReporter,
|
diagnosticReporter = diagnosticReporter,
|
||||||
linkViaSignatures = false,
|
|
||||||
evaluatedConstTracker = compilerConfiguration.putIfAbsent(
|
evaluatedConstTracker = compilerConfiguration.putIfAbsent(
|
||||||
CommonConfigurationKeys.EVALUATED_CONST_TRACKER,
|
CommonConfigurationKeys.EVALUATED_CONST_TRACKER,
|
||||||
EvaluatedConstTracker.create(),
|
EvaluatedConstTracker.create(),
|
||||||
@@ -74,7 +68,6 @@ class Fir2IrConfiguration private constructor(
|
|||||||
Fir2IrConfiguration(
|
Fir2IrConfiguration(
|
||||||
languageVersionSettings = compilerConfiguration.languageVersionSettings,
|
languageVersionSettings = compilerConfiguration.languageVersionSettings,
|
||||||
diagnosticReporter = diagnosticReporter,
|
diagnosticReporter = diagnosticReporter,
|
||||||
linkViaSignatures = false,
|
|
||||||
evaluatedConstTracker = compilerConfiguration.putIfAbsent(
|
evaluatedConstTracker = compilerConfiguration.putIfAbsent(
|
||||||
CommonConfigurationKeys.EVALUATED_CONST_TRACKER,
|
CommonConfigurationKeys.EVALUATED_CONST_TRACKER,
|
||||||
EvaluatedConstTracker.create(),
|
EvaluatedConstTracker.create(),
|
||||||
@@ -93,7 +86,6 @@ class Fir2IrConfiguration private constructor(
|
|||||||
Fir2IrConfiguration(
|
Fir2IrConfiguration(
|
||||||
languageVersionSettings = languageVersionSettings,
|
languageVersionSettings = languageVersionSettings,
|
||||||
diagnosticReporter = diagnosticReporter,
|
diagnosticReporter = diagnosticReporter,
|
||||||
linkViaSignatures = false,
|
|
||||||
evaluatedConstTracker = compilerConfiguration.putIfAbsent(
|
evaluatedConstTracker = compilerConfiguration.putIfAbsent(
|
||||||
CommonConfigurationKeys.EVALUATED_CONST_TRACKER,
|
CommonConfigurationKeys.EVALUATED_CONST_TRACKER,
|
||||||
EvaluatedConstTracker.create(),
|
EvaluatedConstTracker.create(),
|
||||||
|
|||||||
+19
-66
@@ -383,7 +383,6 @@ class Fir2IrDeclarationStorage(
|
|||||||
private fun createMemberFunctionSymbol(
|
private fun createMemberFunctionSymbol(
|
||||||
function: FirFunction,
|
function: FirFunction,
|
||||||
fakeOverrideOwnerLookupTag: ConeClassLikeLookupTag? = null,
|
fakeOverrideOwnerLookupTag: ConeClassLikeLookupTag? = null,
|
||||||
signature: IdSignature?,
|
|
||||||
parentIsExternal: Boolean
|
parentIsExternal: Boolean
|
||||||
): IrSimpleFunctionSymbol {
|
): IrSimpleFunctionSymbol {
|
||||||
if (
|
if (
|
||||||
@@ -392,12 +391,12 @@ class Fir2IrDeclarationStorage(
|
|||||||
function !is FirSimpleFunction ||
|
function !is FirSimpleFunction ||
|
||||||
!function.isFakeOverride(fakeOverrideOwnerLookupTag)
|
!function.isFakeOverride(fakeOverrideOwnerLookupTag)
|
||||||
) {
|
) {
|
||||||
return createFunctionSymbol(signature)
|
return createFunctionSymbol(signature = null)
|
||||||
}
|
}
|
||||||
val containingClassSymbol = findContainingIrClassSymbol(function, fakeOverrideOwnerLookupTag)
|
val containingClassSymbol = findContainingIrClassSymbol(function, fakeOverrideOwnerLookupTag)
|
||||||
val originalFirFunction = function.unwrapFakeOverrides()
|
val originalFirFunction = function.unwrapFakeOverrides()
|
||||||
val originalSymbol = getIrFunctionSymbol(originalFirFunction.symbol) as IrSimpleFunctionSymbol
|
val originalSymbol = getIrFunctionSymbol(originalFirFunction.symbol) as IrSimpleFunctionSymbol
|
||||||
return IrFunctionFakeOverrideSymbol(originalSymbol, containingClassSymbol, signature)
|
return IrFunctionFakeOverrideSymbol(originalSymbol, containingClassSymbol, idSignature = null)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun findContainingIrClassSymbol(
|
private fun findContainingIrClassSymbol(
|
||||||
@@ -480,13 +479,6 @@ class Fir2IrDeclarationStorage(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createConstructorSymbol(signature: IdSignature?): IrConstructorSymbol {
|
|
||||||
return when {
|
|
||||||
signature != null -> symbolTable.referenceConstructor(signature)
|
|
||||||
else -> IrConstructorSymbolImpl()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun cacheIrConstructorSymbol(constructor: FirConstructor, irConstructorSymbol: IrConstructorSymbol) {
|
private fun cacheIrConstructorSymbol(constructor: FirConstructor, irConstructorSymbol: IrConstructorSymbol) {
|
||||||
constructorCache[constructor] = irConstructorSymbol
|
constructorCache[constructor] = irConstructorSymbol
|
||||||
}
|
}
|
||||||
@@ -496,10 +488,7 @@ class Fir2IrDeclarationStorage(
|
|||||||
getCachedIrConstructorSymbol(constructor)?.let { return it }
|
getCachedIrConstructorSymbol(constructor)?.let { return it }
|
||||||
|
|
||||||
// caching of created constructor is not called here, because `callablesGenerator` calls `cacheIrConstructor` by itself
|
// caching of created constructor is not called here, because `callablesGenerator` calls `cacheIrConstructor` by itself
|
||||||
val signature = runIf(!isLocal && configuration.linkViaSignatures) {
|
val symbol = IrConstructorSymbolImpl()
|
||||||
signatureComposer.composeSignature(constructor)
|
|
||||||
}
|
|
||||||
val symbol = createConstructorSymbol(signature)
|
|
||||||
if (!isLocal) {
|
if (!isLocal) {
|
||||||
val irParent = findIrParent(constructor, fakeOverrideOwnerLookupTag = null)
|
val irParent = findIrParent(constructor, fakeOverrideOwnerLookupTag = null)
|
||||||
val isIntrinsicConstEvaluation =
|
val isIntrinsicConstEvaluation =
|
||||||
@@ -565,7 +554,6 @@ class Fir2IrDeclarationStorage(
|
|||||||
createAndCacheIrProperty(
|
createAndCacheIrProperty(
|
||||||
field.toStubProperty(),
|
field.toStubProperty(),
|
||||||
irParent,
|
irParent,
|
||||||
isLocal = false,
|
|
||||||
fakeOverrideOwnerLookupTag = containingClassId?.toLookupTag(),
|
fakeOverrideOwnerLookupTag = containingClassId?.toLookupTag(),
|
||||||
allowLazyDeclarationsCreation = true // pure fields exist only in java
|
allowLazyDeclarationsCreation = true // pure fields exist only in java
|
||||||
)
|
)
|
||||||
@@ -576,14 +564,13 @@ class Fir2IrDeclarationStorage(
|
|||||||
property: FirProperty,
|
property: FirProperty,
|
||||||
irParent: IrDeclarationParent?,
|
irParent: IrDeclarationParent?,
|
||||||
predefinedOrigin: IrDeclarationOrigin? = null,
|
predefinedOrigin: IrDeclarationOrigin? = null,
|
||||||
isLocal: Boolean = false,
|
|
||||||
fakeOverrideOwnerLookupTag: ConeClassLikeLookupTag? = null,
|
fakeOverrideOwnerLookupTag: ConeClassLikeLookupTag? = null,
|
||||||
allowLazyDeclarationsCreation: Boolean = false
|
allowLazyDeclarationsCreation: Boolean = false
|
||||||
): IrProperty {
|
): IrProperty {
|
||||||
@Suppress("NAME_SHADOWING")
|
@Suppress("NAME_SHADOWING")
|
||||||
val property = prepareProperty(property)
|
val property = prepareProperty(property)
|
||||||
|
|
||||||
val symbols = getIrPropertySymbols(property.symbol, fakeOverrideOwnerLookupTag, isLocal)
|
val symbols = getIrPropertySymbols(property.symbol, fakeOverrideOwnerLookupTag)
|
||||||
|
|
||||||
return callablesGenerator.createIrProperty(
|
return callablesGenerator.createIrProperty(
|
||||||
property, irParent, symbols, predefinedOrigin, fakeOverrideOwnerLookupTag, allowLazyDeclarationsCreation
|
property, irParent, symbols, predefinedOrigin, fakeOverrideOwnerLookupTag, allowLazyDeclarationsCreation
|
||||||
@@ -591,7 +578,6 @@ class Fir2IrDeclarationStorage(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun createPropertySymbols(
|
private fun createPropertySymbols(
|
||||||
signature: IdSignature?,
|
|
||||||
property: FirProperty,
|
property: FirProperty,
|
||||||
fakeOverrideOwnerLookupTag: ConeClassLikeLookupTag?,
|
fakeOverrideOwnerLookupTag: ConeClassLikeLookupTag?,
|
||||||
parentIsExternal: Boolean
|
parentIsExternal: Boolean
|
||||||
@@ -601,30 +587,14 @@ class Fir2IrDeclarationStorage(
|
|||||||
!parentIsExternal &&
|
!parentIsExternal &&
|
||||||
property.isFakeOverride(fakeOverrideOwnerLookupTag)
|
property.isFakeOverride(fakeOverrideOwnerLookupTag)
|
||||||
) {
|
) {
|
||||||
return createFakeOverridePropertySymbols(signature, property, fakeOverrideOwnerLookupTag)
|
return createFakeOverridePropertySymbols(property, fakeOverrideOwnerLookupTag)
|
||||||
}
|
}
|
||||||
|
|
||||||
val propertySymbol = when {
|
val propertySymbol = IrPropertySymbolImpl()
|
||||||
signature != null -> when (property.isStubPropertyForPureField) {
|
val getterSymbol = createFunctionSymbol(signature = null)
|
||||||
// Very special case when two similar properties can exist so conflicts in SymbolTable are possible.
|
|
||||||
// See javaCloseFieldAndKotlinProperty.kt in BB tests
|
|
||||||
true -> IrPropertyPublicSymbolImpl(signature).also {
|
|
||||||
symbolTable.declarePropertyWithSignature(signature, it)
|
|
||||||
}
|
|
||||||
else -> symbolTable.referenceProperty(signature)
|
|
||||||
}
|
|
||||||
else -> IrPropertySymbolImpl()
|
|
||||||
}
|
|
||||||
val getterSignature = runIf(signature != null) {
|
|
||||||
signatureComposer.composeAccessorSignature(property, isSetter = false, fakeOverrideOwnerLookupTag)
|
|
||||||
}
|
|
||||||
val getterSymbol = createFunctionSymbol(getterSignature)
|
|
||||||
|
|
||||||
val setterSymbol = runIf(property.isVar) {
|
val setterSymbol = runIf(property.isVar) {
|
||||||
val setterSignature = runIf(signature != null) {
|
createFunctionSymbol(signature = null)
|
||||||
signatureComposer.composeAccessorSignature(property, isSetter = true, fakeOverrideOwnerLookupTag)
|
|
||||||
}
|
|
||||||
createFunctionSymbol(setterSignature)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val backingFieldSymbol = runIf(property.delegate != null || property.hasBackingField) {
|
val backingFieldSymbol = runIf(property.delegate != null || property.hasBackingField) {
|
||||||
@@ -635,33 +605,25 @@ class Fir2IrDeclarationStorage(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun createFakeOverridePropertySymbols(
|
private fun createFakeOverridePropertySymbols(
|
||||||
signature: IdSignature?,
|
|
||||||
property: FirProperty,
|
property: FirProperty,
|
||||||
fakeOverrideOwnerLookupTag: ConeClassLikeLookupTag?,
|
fakeOverrideOwnerLookupTag: ConeClassLikeLookupTag?,
|
||||||
): PropertySymbols {
|
): PropertySymbols {
|
||||||
val originalFirProperty = property.unwrapFakeOverrides()
|
val originalFirProperty = property.unwrapFakeOverrides()
|
||||||
val originalSymbols = getIrPropertySymbols(originalFirProperty.symbol, isLocal = false)
|
val originalSymbols = getIrPropertySymbols(originalFirProperty.symbol)
|
||||||
require(property.isStubPropertyForPureField != true) {
|
require(property.isStubPropertyForPureField != true) {
|
||||||
"What are we doing here?"
|
"What are we doing here?"
|
||||||
}
|
}
|
||||||
|
|
||||||
val containingClassSymbol = findContainingIrClassSymbol(property, fakeOverrideOwnerLookupTag)
|
val containingClassSymbol = findContainingIrClassSymbol(property, fakeOverrideOwnerLookupTag)
|
||||||
val propertySymbol = IrPropertyFakeOverrideSymbol(originalSymbols.propertySymbol, containingClassSymbol, signature)
|
val propertySymbol = IrPropertyFakeOverrideSymbol(originalSymbols.propertySymbol, containingClassSymbol, idSignature = null)
|
||||||
|
val getterSymbol = IrFunctionFakeOverrideSymbol(originalSymbols.getterSymbol, containingClassSymbol, idSignature = null)
|
||||||
val getterSignature = runIf(signature != null) {
|
|
||||||
signatureComposer.composeAccessorSignature(property, isSetter = false, fakeOverrideOwnerLookupTag)
|
|
||||||
}
|
|
||||||
val getterSymbol = IrFunctionFakeOverrideSymbol(originalSymbols.getterSymbol, containingClassSymbol, getterSignature)
|
|
||||||
|
|
||||||
val setterSymbol = runIf(property.isVar) {
|
val setterSymbol = runIf(property.isVar) {
|
||||||
val setterIsVisible = property.setter?.let { setter ->
|
val setterIsVisible = property.setter?.let { setter ->
|
||||||
fakeOverrideOwnerLookupTag?.toFirRegularClass(session)?.let { containingClass -> setter.isVisibleInClass(containingClass) }
|
fakeOverrideOwnerLookupTag?.toFirRegularClass(session)?.let { containingClass -> setter.isVisibleInClass(containingClass) }
|
||||||
} ?: true
|
} ?: true
|
||||||
runIf(setterIsVisible) {
|
runIf(setterIsVisible) {
|
||||||
val setterSignature = runIf(signature != null) {
|
IrFunctionFakeOverrideSymbol(originalSymbols.setterSymbol!!, containingClassSymbol, idSignature = null)
|
||||||
signatureComposer.composeAccessorSignature(property, isSetter = true, fakeOverrideOwnerLookupTag)
|
|
||||||
}
|
|
||||||
IrFunctionFakeOverrideSymbol(originalSymbols.setterSymbol!!, containingClassSymbol, setterSignature)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return PropertySymbols(propertySymbol, getterSymbol, setterSymbol, backingFieldSymbol = null)
|
return PropertySymbols(propertySymbol, getterSymbol, setterSymbol, backingFieldSymbol = null)
|
||||||
@@ -718,37 +680,31 @@ class Fir2IrDeclarationStorage(
|
|||||||
fun getIrPropertySymbol(
|
fun getIrPropertySymbol(
|
||||||
firPropertySymbol: FirPropertySymbol,
|
firPropertySymbol: FirPropertySymbol,
|
||||||
fakeOverrideOwnerLookupTag: ConeClassLikeLookupTag? = null,
|
fakeOverrideOwnerLookupTag: ConeClassLikeLookupTag? = null,
|
||||||
isLocal: Boolean = false
|
|
||||||
): IrSymbol {
|
): IrSymbol {
|
||||||
val property = prepareProperty(firPropertySymbol.fir)
|
val property = prepareProperty(firPropertySymbol.fir)
|
||||||
if (property.isLocal) {
|
if (property.isLocal) {
|
||||||
return localStorage.getDelegatedProperty(property) ?: getIrVariableSymbol(property)
|
return localStorage.getDelegatedProperty(property) ?: getIrVariableSymbol(property)
|
||||||
}
|
}
|
||||||
getCachedIrPropertySymbol(property, fakeOverrideOwnerLookupTag)?.let { return it }
|
getCachedIrPropertySymbol(property, fakeOverrideOwnerLookupTag)?.let { return it }
|
||||||
return getIrPropertySymbols(firPropertySymbol, fakeOverrideOwnerLookupTag, isLocal).propertySymbol
|
return getIrPropertySymbols(firPropertySymbol, fakeOverrideOwnerLookupTag).propertySymbol
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getIrPropertySymbols(
|
private fun getIrPropertySymbols(
|
||||||
firPropertySymbol: FirPropertySymbol,
|
firPropertySymbol: FirPropertySymbol,
|
||||||
fakeOverrideOwnerLookupTag: ConeClassLikeLookupTag? = null,
|
fakeOverrideOwnerLookupTag: ConeClassLikeLookupTag? = null,
|
||||||
isLocal: Boolean
|
|
||||||
): PropertySymbols {
|
): PropertySymbols {
|
||||||
val property = prepareProperty(firPropertySymbol.fir)
|
val property = prepareProperty(firPropertySymbol.fir)
|
||||||
getCachedIrPropertySymbols(property, fakeOverrideOwnerLookupTag)?.let { return it }
|
getCachedIrPropertySymbols(property, fakeOverrideOwnerLookupTag)?.let { return it }
|
||||||
return createAndCacheIrPropertySymbols(property, fakeOverrideOwnerLookupTag, isLocal)
|
return createAndCacheIrPropertySymbols(property, fakeOverrideOwnerLookupTag)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createAndCacheIrPropertySymbols(
|
private fun createAndCacheIrPropertySymbols(
|
||||||
property: FirProperty,
|
property: FirProperty,
|
||||||
fakeOverrideOwnerLookupTag: ConeClassLikeLookupTag?,
|
fakeOverrideOwnerLookupTag: ConeClassLikeLookupTag?,
|
||||||
isLocal: Boolean
|
|
||||||
): PropertySymbols {
|
): PropertySymbols {
|
||||||
val signature = runIf(!isLocal && configuration.linkViaSignatures) {
|
|
||||||
signatureComposer.composeSignature(property, fakeOverrideOwnerLookupTag)
|
|
||||||
}
|
|
||||||
val irParent = findIrParent(property, fakeOverrideOwnerLookupTag)
|
val irParent = findIrParent(property, fakeOverrideOwnerLookupTag)
|
||||||
if (irParent?.isExternalParent() == true) {
|
if (irParent?.isExternalParent() == true) {
|
||||||
val symbols = createPropertySymbols(signature, property, fakeOverrideOwnerLookupTag, parentIsExternal = true)
|
val symbols = createPropertySymbols(property, fakeOverrideOwnerLookupTag, parentIsExternal = true)
|
||||||
val firForLazyProperty = calculateFirForLazyDeclaration(
|
val firForLazyProperty = calculateFirForLazyDeclaration(
|
||||||
property, fakeOverrideOwnerLookupTag, irParent,
|
property, fakeOverrideOwnerLookupTag, irParent,
|
||||||
fakeOverrideGenerator::createFirPropertyFakeOverrideIfNeeded
|
fakeOverrideGenerator::createFirPropertyFakeOverrideIfNeeded
|
||||||
@@ -768,7 +724,7 @@ class Fir2IrDeclarationStorage(
|
|||||||
return symbols
|
return symbols
|
||||||
}
|
}
|
||||||
|
|
||||||
val symbols = createPropertySymbols(signature, property, fakeOverrideOwnerLookupTag, parentIsExternal = false)
|
val symbols = createPropertySymbols(property, fakeOverrideOwnerLookupTag, parentIsExternal = false)
|
||||||
cacheIrPropertySymbols(property, symbols, fakeOverrideOwnerLookupTag)
|
cacheIrPropertySymbols(property, symbols, fakeOverrideOwnerLookupTag)
|
||||||
|
|
||||||
return symbols
|
return symbols
|
||||||
@@ -895,7 +851,7 @@ class Fir2IrDeclarationStorage(
|
|||||||
propertyCache[fir]?.ownerIfBound()?.let { return it.backingField!!.symbol }
|
propertyCache[fir]?.ownerIfBound()?.let { return it.backingField!!.symbol }
|
||||||
val irParent = findIrParent(fir, fakeOverrideOwnerLookupTag = null)
|
val irParent = findIrParent(fir, fakeOverrideOwnerLookupTag = null)
|
||||||
val parentOrigin = (irParent as? IrDeclaration)?.origin ?: IrDeclarationOrigin.DEFINED
|
val parentOrigin = (irParent as? IrDeclaration)?.origin ?: IrDeclarationOrigin.DEFINED
|
||||||
createAndCacheIrProperty(fir, irParent, predefinedOrigin = parentOrigin, isLocal = false).backingField!!.symbol
|
createAndCacheIrProperty(fir, irParent, predefinedOrigin = parentOrigin).backingField!!.symbol
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
getIrVariableSymbol(fir)
|
getIrVariableSymbol(fir)
|
||||||
@@ -1129,13 +1085,10 @@ class Fir2IrDeclarationStorage(
|
|||||||
}
|
}
|
||||||
|
|
||||||
getCachedIrFunctionSymbol(function, fakeOverrideOwnerLookupTag)?.let { return it }
|
getCachedIrFunctionSymbol(function, fakeOverrideOwnerLookupTag)?.let { return it }
|
||||||
val signature = runIf(!isLocal && configuration.linkViaSignatures) {
|
|
||||||
signatureComposer.composeSignature(firFunctionSymbol.fir, fakeOverrideOwnerLookupTag)
|
|
||||||
}
|
|
||||||
if (function is FirSimpleFunction && !isLocal) {
|
if (function is FirSimpleFunction && !isLocal) {
|
||||||
val irParent = findIrParent(function, fakeOverrideOwnerLookupTag)
|
val irParent = findIrParent(function, fakeOverrideOwnerLookupTag)
|
||||||
if (irParent?.isExternalParent() == true) {
|
if (irParent?.isExternalParent() == true) {
|
||||||
val symbol = createMemberFunctionSymbol(function, fakeOverrideOwnerLookupTag, signature, parentIsExternal = true)
|
val symbol = createMemberFunctionSymbol(function, fakeOverrideOwnerLookupTag, parentIsExternal = true)
|
||||||
val firForLazyFunction = calculateFirForLazyDeclaration(
|
val firForLazyFunction = calculateFirForLazyDeclaration(
|
||||||
function, fakeOverrideOwnerLookupTag, irParent,
|
function, fakeOverrideOwnerLookupTag, irParent,
|
||||||
fakeOverrideGenerator::createFirFunctionFakeOverrideIfNeeded
|
fakeOverrideGenerator::createFirFunctionFakeOverrideIfNeeded
|
||||||
@@ -1158,7 +1111,7 @@ class Fir2IrDeclarationStorage(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val symbol = createMemberFunctionSymbol(function, fakeOverrideOwnerLookupTag, signature, parentIsExternal = false)
|
val symbol = createMemberFunctionSymbol(function, fakeOverrideOwnerLookupTag, parentIsExternal = false)
|
||||||
cacheIrFunctionSymbol(function, symbol, fakeOverrideOwnerLookupTag)
|
cacheIrFunctionSymbol(function, symbol, fakeOverrideOwnerLookupTag)
|
||||||
return symbol
|
return symbol
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -135,12 +135,11 @@ class FakeOverrideGenerator(
|
|||||||
createFakeOverriddenIfNeeded(
|
createFakeOverriddenIfNeeded(
|
||||||
firClass, irClass, isLocal, propertyOrFieldSymbol,
|
firClass, irClass, isLocal, propertyOrFieldSymbol,
|
||||||
declarationStorage::getCachedIrPropertySymbol,
|
declarationStorage::getCachedIrPropertySymbol,
|
||||||
{ property, irParent, predefinedOrigin, isLocal ->
|
{ property, irParent, predefinedOrigin, _ ->
|
||||||
declarationStorage.createAndCacheIrProperty(
|
declarationStorage.createAndCacheIrProperty(
|
||||||
property,
|
property,
|
||||||
irParent,
|
irParent,
|
||||||
predefinedOrigin,
|
predefinedOrigin,
|
||||||
isLocal,
|
|
||||||
allowLazyDeclarationsCreation = true
|
allowLazyDeclarationsCreation = true
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|||||||
+2
-2
@@ -68,7 +68,7 @@ class Fir2IrJvmResultsConverter(
|
|||||||
|
|
||||||
val phaseConfig = configuration.get(CLIConfigurationKeys.PHASE_CONFIG)
|
val phaseConfig = configuration.get(CLIConfigurationKeys.PHASE_CONFIG)
|
||||||
|
|
||||||
val commonMemberStorage = Fir2IrCommonMemberStorage(signatureComposerForJvmFir2Ir(false), FirJvmKotlinMangler())
|
val commonMemberStorage = Fir2IrCommonMemberStorage(signatureComposerForJvmFir2Ir(), FirJvmKotlinMangler())
|
||||||
val diagnosticReporter = DiagnosticReporterFactory.createReporter()
|
val diagnosticReporter = DiagnosticReporterFactory.createReporter()
|
||||||
|
|
||||||
val compilerConfiguration = compilerConfigurationProvider.getCompilerConfiguration(module)
|
val compilerConfiguration = compilerConfigurationProvider.getCompilerConfiguration(module)
|
||||||
@@ -78,7 +78,7 @@ class Fir2IrJvmResultsConverter(
|
|||||||
fir2IrExtensions,
|
fir2IrExtensions,
|
||||||
fir2IrConfiguration,
|
fir2IrConfiguration,
|
||||||
module.irGenerationExtensions(testServices),
|
module.irGenerationExtensions(testServices),
|
||||||
signatureComposerForJvmFir2Ir(false),
|
signatureComposerForJvmFir2Ir(),
|
||||||
irMangler,
|
irMangler,
|
||||||
FirJvmKotlinMangler(),
|
FirJvmKotlinMangler(),
|
||||||
FirJvmVisibilityConverter,
|
FirJvmVisibilityConverter,
|
||||||
|
|||||||
Reference in New Issue
Block a user