[FIR2IR] Get rid of FirBasedSignatureComposer.withFileSignature

This commit is contained in:
Dmitriy Novozhilov
2023-07-13 10:41:59 +03:00
committed by Space Team
parent 80ae5f3ec7
commit 93c3bcbd74
3 changed files with 2 additions and 34 deletions
@@ -19,10 +19,7 @@ class Fir2IrCommonMemberStorage(
) {
val firSignatureComposer = FirBasedSignatureComposer(firMangler)
val symbolTable = SymbolTable(
signaturer = WrappedDescriptorSignatureComposer(signatureComposer, firSignatureComposer),
irFactory = IrFactoryImpl
)
val symbolTable = SymbolTable(signaturer = signatureComposer, irFactory = IrFactoryImpl)
val classCache: MutableMap<FirRegularClass, IrClass> = mutableMapOf()
@@ -1,21 +0,0 @@
/*
* 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.signaturer.FirBasedSignatureComposer
import org.jetbrains.kotlin.ir.util.IdSignature
import org.jetbrains.kotlin.ir.util.IdSignatureComposer
class WrappedDescriptorSignatureComposer(
private val delegate: IdSignatureComposer,
private val firComposer: FirBasedSignatureComposer
) : IdSignatureComposer by delegate {
override fun withFileSignature(fileSignature: IdSignature.FileSignature, body: () -> Unit) {
firComposer.withFileSignature(fileSignature) {
delegate.withFileSignature(fileSignature, body)
}
}
}
@@ -23,14 +23,6 @@ import org.jetbrains.kotlin.name.FqName
// @NoMutableState -- we'll restore this annotation once we get rid of withFileSignature().
class FirBasedSignatureComposer(val mangler: FirMangler) {
private var fileSignature: IdSignature.FileSignature? = null
fun withFileSignature(sig: IdSignature.FileSignature, body: () -> Unit) {
fileSignature = sig
body()
fileSignature = null
}
private data class FirDeclarationWithParentId(val declaration: FirDeclaration, val classId: ClassId?, val forceExpect: Boolean)
private val signatureCache = mutableMapOf<FirDeclarationWithParentId, IdSignature.CommonSignature>()
@@ -123,7 +115,7 @@ class FirBasedSignatureComposer(val mangler: FirMangler) {
}
val resultSignature: IdSignature = if (isTopLevelPrivate(declaration)) {
val fileSig = fileSignature ?: declaration.fakeFileSignature(publicSignature)
val fileSig = declaration.fakeFileSignature(publicSignature)
IdSignature.CompositeSignature(fileSig, publicSignature)
} else
publicSignature