[IR] Drop expectDescriptorToSymbol completely
^KT-61136
This commit is contained in:
committed by
Space Team
parent
9eb5b41ed8
commit
033bb385b9
@@ -33,7 +33,6 @@ import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||
import org.jetbrains.kotlin.cli.jvm.plugins.PluginCliParser
|
||||
import org.jetbrains.kotlin.config.*
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticReporterFactory
|
||||
import org.jetbrains.kotlin.incremental.components.ExpectActualTracker
|
||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||
@@ -48,7 +47,6 @@ import org.jetbrains.kotlin.ir.backend.js.transformers.irToJs.*
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImplForJsIC
|
||||
import org.jetbrains.kotlin.ir.linkage.partial.setupPartialLinkageConfig
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||
import org.jetbrains.kotlin.js.analyzer.JsAnalysisResult
|
||||
import org.jetbrains.kotlin.js.config.*
|
||||
import org.jetbrains.kotlin.konan.file.ZipFileSystemAccessor
|
||||
@@ -442,7 +440,6 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
|
||||
if (sourceModule.jsFrontEndResult.jsAnalysisResult.shouldGenerateCode && (arguments.irProduceKlibDir || arguments.irProduceKlibFile)) {
|
||||
val moduleSourceFiles = (sourceModule.mainModule as MainModule.SourceFiles).files
|
||||
val icData = environmentForJS.configuration.incrementalDataProvider?.getSerializedData(moduleSourceFiles) ?: emptyList()
|
||||
val expectDescriptorToSymbol = mutableMapOf<DeclarationDescriptor, IrSymbol>()
|
||||
|
||||
val (moduleFragment, _) = generateIrForKlibSerialization(
|
||||
environmentForJS.project,
|
||||
@@ -451,7 +448,6 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
|
||||
sourceModule.jsFrontEndResult.jsAnalysisResult,
|
||||
sourceModule.allDependencies,
|
||||
icData,
|
||||
expectDescriptorToSymbol,
|
||||
IrFactoryImpl,
|
||||
verifySignatures = true
|
||||
) {
|
||||
@@ -471,7 +467,6 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
|
||||
nopack = arguments.irProduceKlibDir,
|
||||
jsOutputName = arguments.irPerModuleOutputName,
|
||||
icData = icData,
|
||||
expectDescriptorToSymbol = expectDescriptorToSymbol,
|
||||
moduleFragment = moduleFragment,
|
||||
builtInsPlatform = if (arguments.wasm) BuiltInsPlatform.WASM else BuiltInsPlatform.JS
|
||||
) { file ->
|
||||
|
||||
@@ -319,7 +319,6 @@ fun serializeFirKlib(
|
||||
klibPath = outputKlibPath,
|
||||
moduleStructure.allDependencies,
|
||||
fir2IrActualizedResult.irModuleFragment,
|
||||
expectDescriptorToSymbol = mutableMapOf(),
|
||||
cleanFiles = icData ?: emptyList(),
|
||||
nopack = nopack,
|
||||
perFile = false,
|
||||
|
||||
@@ -25,7 +25,6 @@ import org.jetbrains.kotlin.backend.common.serialization.signature.IdSignatureDe
|
||||
import org.jetbrains.kotlin.config.CommonConfigurationKeys
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.config.languageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.ir.backend.js.KotlinFileSerializedData
|
||||
import org.jetbrains.kotlin.ir.backend.js.generateModuleFragmentWithPlugins
|
||||
@@ -35,7 +34,6 @@ import org.jetbrains.kotlin.ir.backend.js.lower.serialization.ir.JsManglerIr
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFactory
|
||||
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
||||
import org.jetbrains.kotlin.ir.linkage.partial.partialLinkageConfig
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||
import org.jetbrains.kotlin.ir.util.IrMessageLogger
|
||||
import org.jetbrains.kotlin.ir.util.SymbolTable
|
||||
import org.jetbrains.kotlin.ir.visitors.acceptVoid
|
||||
@@ -54,7 +52,6 @@ fun generateIrForKlibSerialization(
|
||||
analysisResult: AnalysisResult,
|
||||
sortedDependencies: Collection<KotlinLibrary>,
|
||||
icData: List<KotlinFileSerializedData>,
|
||||
expectDescriptorToSymbol: MutableMap<DeclarationDescriptor, IrSymbol>,
|
||||
irFactory: IrFactory,
|
||||
verifySignatures: Boolean = true,
|
||||
getDescriptorByLibrary: (KotlinLibrary) -> ModuleDescriptor,
|
||||
@@ -102,7 +99,6 @@ fun generateIrForKlibSerialization(
|
||||
files,
|
||||
irLinker,
|
||||
messageLogger,
|
||||
expectDescriptorToSymbol,
|
||||
stubGenerator
|
||||
)
|
||||
|
||||
|
||||
-1
@@ -264,7 +264,6 @@ open class JvmIrCodegenFactory(
|
||||
input.files,
|
||||
irProviders,
|
||||
pluginExtensions,
|
||||
expectDescriptorToSymbol = null,
|
||||
fragmentInfo = evaluatorFragmentInfoForPsi2Ir
|
||||
)
|
||||
|
||||
|
||||
@@ -17,12 +17,10 @@
|
||||
package org.jetbrains.kotlin.psi2ir
|
||||
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
||||
import org.jetbrains.kotlin.ir.linkage.IrDeserializer
|
||||
import org.jetbrains.kotlin.ir.linkage.IrProvider
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||
import org.jetbrains.kotlin.ir.util.SymbolTable
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.psi2ir.descriptors.IrBuiltInsOverDescriptors
|
||||
@@ -86,13 +84,12 @@ class Psi2IrTranslator(
|
||||
ktFiles: Collection<KtFile>,
|
||||
irProviders: List<IrProvider>,
|
||||
linkerExtensions: Collection<IrDeserializer.IrLinkerExtension>,
|
||||
expectDescriptorToSymbol: MutableMap<DeclarationDescriptor, IrSymbol>? = null,
|
||||
fragmentInfo: EvaluatorFragmentInfo? = null
|
||||
): IrModuleFragment {
|
||||
|
||||
val moduleGenerator = fragmentInfo?.let {
|
||||
FragmentModuleGenerator(context, it)
|
||||
} ?: ModuleGenerator(context, expectDescriptorToSymbol)
|
||||
} ?: ModuleGenerator(context)
|
||||
|
||||
val irModule = moduleGenerator.generateModuleFragment(ktFiles)
|
||||
|
||||
|
||||
-99
@@ -1,99 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2020 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.psi2ir.generators
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||
import org.jetbrains.kotlin.ir.util.SymbolTable
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid
|
||||
import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid
|
||||
import org.jetbrains.kotlin.ir.visitors.acceptVoid
|
||||
import org.jetbrains.kotlin.resolve.multiplatform.findExpects
|
||||
|
||||
// Need to create unbound symbols for expects corresponding to actuals of the currently compiled module.
|
||||
// This is necessary because there are no explicit links between expects and actuals
|
||||
// neither in descriptors nor in IR.
|
||||
internal fun referenceExpectsForUsedActuals(
|
||||
expectDescriptorToSymbol: MutableMap<DeclarationDescriptor, IrSymbol>,
|
||||
symbolTable: SymbolTable,
|
||||
element: IrElement,
|
||||
) {
|
||||
element.acceptVoid(ExpectDependencyGenerator(expectDescriptorToSymbol, symbolTable))
|
||||
}
|
||||
|
||||
private class ExpectDependencyGenerator(
|
||||
private val expectDescriptorToSymbol: MutableMap<DeclarationDescriptor, IrSymbol>,
|
||||
private val symbolTable: SymbolTable,
|
||||
) : IrElementVisitorVoid {
|
||||
private fun <T> T.forEachExpect(body: (DeclarationDescriptor) -> Unit) where T : IrDeclaration {
|
||||
this.descriptor.findExpects().forEach {
|
||||
body(it)
|
||||
}
|
||||
}
|
||||
|
||||
override fun visitElement(element: IrElement) {
|
||||
element.acceptChildrenVoid(this)
|
||||
}
|
||||
|
||||
override fun visitClass(declaration: IrClass) {
|
||||
declaration.forEachExpect { expectDescriptor ->
|
||||
val symbol = symbolTable.descriptorExtension.referenceClass(expectDescriptor as ClassDescriptor)
|
||||
expectDescriptorToSymbol[expectDescriptor] = symbol
|
||||
expectDescriptor.constructors.forEach {
|
||||
expectDescriptorToSymbol[it] = symbolTable.descriptorExtension.referenceConstructor(it as ClassConstructorDescriptor)
|
||||
}
|
||||
}
|
||||
super.visitDeclaration(declaration)
|
||||
}
|
||||
|
||||
override fun visitSimpleFunction(declaration: IrSimpleFunction) {
|
||||
declaration.forEachExpect {
|
||||
val symbol = symbolTable.descriptorExtension.referenceSimpleFunction(it as FunctionDescriptor)
|
||||
expectDescriptorToSymbol[it] = symbol
|
||||
}
|
||||
super.visitDeclaration(declaration)
|
||||
}
|
||||
|
||||
override fun visitConstructor(declaration: IrConstructor) {
|
||||
declaration.forEachExpect {
|
||||
val symbol = symbolTable.descriptorExtension.referenceConstructor(it as ClassConstructorDescriptor)
|
||||
expectDescriptorToSymbol[it] = symbol
|
||||
|
||||
}
|
||||
super.visitDeclaration(declaration)
|
||||
}
|
||||
|
||||
override fun visitProperty(declaration: IrProperty) {
|
||||
declaration.forEachExpect {
|
||||
val symbol = symbolTable.descriptorExtension.referenceProperty(it as PropertyDescriptor)
|
||||
expectDescriptorToSymbol[it] = symbol
|
||||
}
|
||||
super.visitDeclaration(declaration)
|
||||
}
|
||||
|
||||
override fun visitEnumEntry(declaration: IrEnumEntry) {
|
||||
declaration.forEachExpect {
|
||||
val symbol = symbolTable.descriptorExtension.referenceEnumEntry(it as ClassDescriptor)
|
||||
expectDescriptorToSymbol[it] = symbol
|
||||
|
||||
}
|
||||
super.visitDeclaration(declaration)
|
||||
}
|
||||
|
||||
override fun visitTypeAlias(declaration: IrTypeAlias) {
|
||||
declaration.forEachExpect {
|
||||
val symbol = when (it) {
|
||||
is ClassDescriptor -> symbolTable.descriptorExtension.referenceClass(it)
|
||||
else -> error("Unexpected expect for actual type alias: $it")
|
||||
}
|
||||
expectDescriptorToSymbol[it] = symbol
|
||||
|
||||
}
|
||||
super.visitDeclaration(declaration)
|
||||
}
|
||||
}
|
||||
+1
-10
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.kotlin.psi2ir.generators
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.CodegenUtil
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.impl.EmptyPackageFragmentDescriptor
|
||||
import org.jetbrains.kotlin.ir.IrFileEntry
|
||||
import org.jetbrains.kotlin.ir.PsiIrFileEntry
|
||||
@@ -28,7 +27,6 @@ import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.IrFileImpl
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.IrModuleFragmentImpl
|
||||
import org.jetbrains.kotlin.ir.linkage.IrProvider
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||
import org.jetbrains.kotlin.ir.util.ExternalDependenciesGenerator
|
||||
import org.jetbrains.kotlin.ir.util.patchDeclarationParents
|
||||
import org.jetbrains.kotlin.ir.visitors.acceptVoid
|
||||
@@ -40,10 +38,7 @@ import org.jetbrains.kotlin.resolve.lazy.descriptors.findPackageFragmentForFile
|
||||
import org.jetbrains.kotlin.types.error.ErrorUtils
|
||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||
|
||||
open class ModuleGenerator(
|
||||
override val context: GeneratorContext,
|
||||
private val expectDescriptorToSymbol: MutableMap<DeclarationDescriptor, IrSymbol>? = null
|
||||
) : Generator {
|
||||
open class ModuleGenerator(override val context: GeneratorContext) : Generator {
|
||||
|
||||
open fun generateModuleFragment(ktFiles: Collection<KtFile>): IrModuleFragment =
|
||||
IrModuleFragmentImpl(context.moduleDescriptor, context.irBuiltIns).also { irModule ->
|
||||
@@ -75,10 +70,6 @@ open class ModuleGenerator(
|
||||
|
||||
irFile.patchDeclarationParents()
|
||||
|
||||
if (expectDescriptorToSymbol != null) {
|
||||
referenceExpectsForUsedActuals(expectDescriptorToSymbol, context.symbolTable, irFile)
|
||||
}
|
||||
|
||||
IrSyntheticDeclarationGenerator(context).generateSyntheticDeclarations(irFile)
|
||||
|
||||
if (context.configuration.skipBodies) {
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import org.jetbrains.kotlin.resolve.lazy.descriptors.findPackageFragmentForFile
|
||||
class FragmentModuleGenerator(
|
||||
override val context: GeneratorContext,
|
||||
private val fragmentInfo: EvaluatorFragmentInfo
|
||||
) : ModuleGenerator(context, expectDescriptorToSymbol = null) {
|
||||
) : ModuleGenerator(context) {
|
||||
|
||||
override fun generateModuleFragment(
|
||||
ktFiles: Collection<KtFile>,
|
||||
|
||||
@@ -42,7 +42,6 @@ import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
||||
import org.jetbrains.kotlin.ir.descriptors.IrDescriptorBasedFunctionFactory
|
||||
import org.jetbrains.kotlin.ir.linkage.IrDeserializer
|
||||
import org.jetbrains.kotlin.ir.linkage.partial.partialLinkageConfig
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||
import org.jetbrains.kotlin.ir.util.*
|
||||
import org.jetbrains.kotlin.ir.visitors.acceptVoid
|
||||
import org.jetbrains.kotlin.js.analyze.AbstractTopDownAnalyzerFacadeForWeb
|
||||
@@ -129,7 +128,6 @@ fun generateKLib(
|
||||
abiVersion: KotlinAbiVersion = KotlinAbiVersion.CURRENT,
|
||||
jsOutputName: String?,
|
||||
icData: List<KotlinFileSerializedData>,
|
||||
expectDescriptorToSymbol: MutableMap<DeclarationDescriptor, IrSymbol>,
|
||||
moduleFragment: IrModuleFragment,
|
||||
builtInsPlatform: BuiltInsPlatform = BuiltInsPlatform.JS,
|
||||
serializeSingleFile: (KtSourceFile) -> ProtoBuf.PackageFragment
|
||||
@@ -147,7 +145,6 @@ fun generateKLib(
|
||||
outputKlibPath,
|
||||
allDependencies,
|
||||
moduleFragment,
|
||||
expectDescriptorToSymbol,
|
||||
icData,
|
||||
nopack,
|
||||
perFile = false,
|
||||
@@ -413,7 +410,6 @@ fun GeneratorContext.generateModuleFragmentWithPlugins(
|
||||
files: List<KtFile>,
|
||||
irLinker: IrDeserializer,
|
||||
messageLogger: IrMessageLogger,
|
||||
expectDescriptorToSymbol: MutableMap<DeclarationDescriptor, IrSymbol>? = null,
|
||||
stubGenerator: DeclarationStubGenerator? = null
|
||||
): Pair<IrModuleFragment, IrPluginContext> {
|
||||
val psi2Ir = Psi2IrTranslator(languageVersionSettings, configuration, messageLogger::checkNoUnboundSymbols)
|
||||
@@ -449,8 +445,7 @@ fun GeneratorContext.generateModuleFragmentWithPlugins(
|
||||
this,
|
||||
files,
|
||||
listOf(stubGenerator ?: irLinker),
|
||||
extensions,
|
||||
expectDescriptorToSymbol
|
||||
extensions
|
||||
) to pluginContext
|
||||
}
|
||||
|
||||
@@ -662,7 +657,6 @@ fun serializeModuleIntoKlib(
|
||||
klibPath: String,
|
||||
dependencies: List<KotlinLibrary>,
|
||||
moduleFragment: IrModuleFragment,
|
||||
@Suppress("UNUSED_PARAMETER") expectDescriptorToSymbol: MutableMap<DeclarationDescriptor, IrSymbol>, // TODO: to be removed later
|
||||
cleanFiles: List<KotlinFileSerializedData>,
|
||||
nopack: Boolean,
|
||||
perFile: Boolean,
|
||||
|
||||
@@ -10,12 +10,10 @@ import org.jetbrains.kotlin.backend.common.actualizer.IrActualizedResult
|
||||
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.diagnostics.impl.BaseDiagnosticsCollector
|
||||
import org.jetbrains.kotlin.fir.backend.FirMangler
|
||||
import org.jetbrains.kotlin.ir.backend.js.KotlinFileSerializedData
|
||||
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||
import org.jetbrains.kotlin.ir.util.KotlinMangler
|
||||
import org.jetbrains.kotlin.metadata.ProtoBuf
|
||||
import org.jetbrains.kotlin.test.model.BackendKind
|
||||
@@ -84,7 +82,6 @@ sealed class IrBackendInput : ResultingArtifact.BackendInput<IrBackendInput>() {
|
||||
override val irPluginContext: IrPluginContext,
|
||||
val sourceFiles: List<KtSourceFile>,
|
||||
val icData: List<KotlinFileSerializedData>,
|
||||
val expectDescriptorToSymbol: MutableMap<DeclarationDescriptor, IrSymbol>, // TODO: abstract from descriptors
|
||||
override val diagnosticReporter: BaseDiagnosticsCollector,
|
||||
val hasErrors: Boolean,
|
||||
override val descriptorMangler: KotlinMangler.DescriptorMangler,
|
||||
@@ -116,7 +113,6 @@ sealed class IrBackendInput : ResultingArtifact.BackendInput<IrBackendInput>() {
|
||||
override val irPluginContext: IrPluginContext,
|
||||
val sourceFiles: List<KtSourceFile>,
|
||||
val icData: List<KotlinFileSerializedData>,
|
||||
val expectDescriptorToSymbol: MutableMap<DeclarationDescriptor, IrSymbol>, // TODO: abstract from descriptors
|
||||
override val diagnosticReporter: BaseDiagnosticsCollector,
|
||||
val hasErrors: Boolean,
|
||||
override val descriptorMangler: KotlinMangler.DescriptorMangler,
|
||||
|
||||
-8
@@ -14,13 +14,11 @@ import org.jetbrains.kotlin.cli.js.klib.generateIrForKlibSerialization
|
||||
import org.jetbrains.kotlin.codegen.ClassBuilderFactories
|
||||
import org.jetbrains.kotlin.codegen.CodegenFactory
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticReporterFactory
|
||||
import org.jetbrains.kotlin.ir.backend.js.*
|
||||
import org.jetbrains.kotlin.ir.backend.js.lower.serialization.ir.JsManglerIr
|
||||
import org.jetbrains.kotlin.ir.backend.jvm.serialization.JvmIrMangler
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||
import org.jetbrains.kotlin.ir.util.SymbolTable
|
||||
import org.jetbrains.kotlin.js.config.ErrorTolerancePolicy
|
||||
import org.jetbrains.kotlin.js.config.JSConfigurationKeys
|
||||
@@ -92,7 +90,6 @@ class ClassicFrontend2IrConverter(
|
||||
|
||||
val sourceFiles = psiFiles.values.toList()
|
||||
val icData = configuration.incrementalDataProvider?.getSerializedData(sourceFiles) ?: emptyList()
|
||||
val expectDescriptorToSymbol = mutableMapOf<DeclarationDescriptor, IrSymbol>()
|
||||
|
||||
val (moduleFragment, pluginContext) = generateIrForKlibSerialization(
|
||||
project,
|
||||
@@ -101,7 +98,6 @@ class ClassicFrontend2IrConverter(
|
||||
analysisResult,
|
||||
sortDependencies(JsEnvironmentConfigurator.getAllDependenciesMappingFor(module, testServices)),
|
||||
icData,
|
||||
expectDescriptorToSymbol,
|
||||
IrFactoryImpl,
|
||||
verifySignatures
|
||||
) {
|
||||
@@ -118,7 +114,6 @@ class ClassicFrontend2IrConverter(
|
||||
pluginContext,
|
||||
sourceFiles.map(::KtPsiSourceFile),
|
||||
icData,
|
||||
expectDescriptorToSymbol = expectDescriptorToSymbol,
|
||||
diagnosticReporter = DiagnosticReporterFactory.createReporter(),
|
||||
hasErrors,
|
||||
descriptorMangler = (pluginContext.symbolTable as SymbolTable).signaturer.mangler,
|
||||
@@ -137,7 +132,6 @@ class ClassicFrontend2IrConverter(
|
||||
|
||||
val sourceFiles = psiFiles.values.toList()
|
||||
val icData = configuration.incrementalDataProvider?.getSerializedData(sourceFiles) ?: emptyList()
|
||||
val expectDescriptorToSymbol = mutableMapOf<DeclarationDescriptor, IrSymbol>()
|
||||
|
||||
val (moduleFragment, pluginContext) = generateIrForKlibSerialization(
|
||||
project,
|
||||
@@ -146,7 +140,6 @@ class ClassicFrontend2IrConverter(
|
||||
analysisResult,
|
||||
sortDependencies(WasmEnvironmentConfigurator.getAllDependenciesMappingFor(module, testServices)),
|
||||
icData,
|
||||
expectDescriptorToSymbol,
|
||||
IrFactoryImpl,
|
||||
verifySignatures
|
||||
) {
|
||||
@@ -164,7 +157,6 @@ class ClassicFrontend2IrConverter(
|
||||
pluginContext,
|
||||
sourceFiles.map(::KtPsiSourceFile),
|
||||
icData,
|
||||
expectDescriptorToSymbol = expectDescriptorToSymbol,
|
||||
diagnosticReporter = DiagnosticReporterFactory.createReporter(),
|
||||
hasErrors,
|
||||
descriptorMangler = (pluginContext.symbolTable as SymbolTable).signaturer.mangler,
|
||||
|
||||
-1
@@ -121,7 +121,6 @@ class Fir2IrJsResultsConverter(
|
||||
mainPluginContext,
|
||||
sourceFiles,
|
||||
configuration.incrementalDataProvider?.getSerializedData(sourceFiles) ?: emptyList(),
|
||||
expectDescriptorToSymbol = mutableMapOf(),
|
||||
diagnosticReporter = diagnosticReporter,
|
||||
hasErrors = inputArtifact.hasErrors,
|
||||
descriptorMangler = commonMemberStorage.symbolTable.signaturer.mangler,
|
||||
|
||||
-1
@@ -119,7 +119,6 @@ class Fir2IrWasmResultsConverter(
|
||||
mainPluginContext,
|
||||
sourceFiles,
|
||||
configuration.incrementalDataProvider?.getSerializedData(sourceFiles) ?: emptyList(),
|
||||
expectDescriptorToSymbol = mutableMapOf(),
|
||||
diagnosticReporter = diagnosticReporter,
|
||||
hasErrors = inputArtifact.hasErrors,
|
||||
descriptorMangler = commonMemberStorage.symbolTable.signaturer.mangler,
|
||||
|
||||
@@ -35,7 +35,6 @@ import org.jetbrains.kotlin.ir.backend.js.lower.serialization.ir.JsIrModuleSeria
|
||||
import org.jetbrains.kotlin.ir.backend.js.lower.serialization.ir.JsManglerDesc
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||
import org.jetbrains.kotlin.ir.util.*
|
||||
import org.jetbrains.kotlin.ir.visitors.*
|
||||
import org.jetbrains.kotlin.js.analyze.TopDownAnalyzerFacadeForJS
|
||||
@@ -95,11 +94,10 @@ abstract class AbstractKlibIrTextTestCase : CodegenTestCase() {
|
||||
}
|
||||
|
||||
fun doTest(wholeFile: File) {
|
||||
val expectActualSymbols = mutableMapOf<DeclarationDescriptor, IrSymbol>()
|
||||
val ignoreErrors = AbstractIrGeneratorTestCase.shouldIgnoreErrors(wholeFile)
|
||||
|
||||
val stdlib = loadKlibFromPath(listOf(runtimeKlibPath)).single()
|
||||
val (irModule, bindingContext) = generateIrModule(stdlib, ignoreErrors, expectActualSymbols)
|
||||
val (irModule, bindingContext) = generateIrModule(stdlib, ignoreErrors)
|
||||
irModule.cleanUpFromExpectDeclarations()
|
||||
|
||||
val expected = irModule.dump(DumpIrTreeOptions(stableOrder = true, verboseErrorTypes = false))
|
||||
@@ -287,7 +285,6 @@ abstract class AbstractKlibIrTextTestCase : CodegenTestCase() {
|
||||
private fun generateIrModule(
|
||||
stdlib: KotlinLibrary,
|
||||
ignoreErrors: Boolean,
|
||||
expectActualSymbols: MutableMap<DeclarationDescriptor, IrSymbol>
|
||||
): Pair<IrModuleFragment, BindingContext> {
|
||||
val stdlibDescriptor = getModuleDescriptor(stdlib)
|
||||
|
||||
@@ -319,7 +316,7 @@ abstract class AbstractKlibIrTextTestCase : CodegenTestCase() {
|
||||
val irLinker = JsIrLinker(moduleDescriptor, messageLogger, irBuiltIns, symbolTable, PartialLinkageSupportForLinker.DISABLED, null)
|
||||
irLinker.deserializeIrModuleHeader(stdlibDescriptor, stdlib)
|
||||
|
||||
return psi2Ir.generateModuleFragment(context, ktFiles, listOf(irLinker), emptyList(), expectActualSymbols) to bindingContext
|
||||
return psi2Ir.generateModuleFragment(context, ktFiles, listOf(irLinker), emptyList()) to bindingContext
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,11 +18,9 @@ import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||
import org.jetbrains.kotlin.codegen.CodegenTestCase
|
||||
import org.jetbrains.kotlin.config.CommonConfigurationKeys
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.incremental.md5
|
||||
import org.jetbrains.kotlin.ir.backend.js.*
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||
import org.jetbrains.kotlin.protobuf.ExtensionRegistryLite
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil
|
||||
@@ -62,7 +60,6 @@ class FilePathsInKlibTest : CodegenTestCase() {
|
||||
// TODO: improve API for generateIrForKlibSerialization and related functionality and remove code duplication here and in similar places in the code
|
||||
val sourceFiles = (module.mainModule as MainModule.SourceFiles).files
|
||||
val icData = module.compilerConfiguration.incrementalDataProvider?.getSerializedData(sourceFiles) ?: emptyList()
|
||||
val expectDescriptorToSymbol = mutableMapOf<DeclarationDescriptor, IrSymbol>()
|
||||
val (moduleFragment, _) = generateIrForKlibSerialization(
|
||||
module.project,
|
||||
sourceFiles,
|
||||
@@ -70,7 +67,6 @@ class FilePathsInKlibTest : CodegenTestCase() {
|
||||
module.jsFrontEndResult.jsAnalysisResult,
|
||||
sortDependencies(module.moduleDependencies),
|
||||
icData,
|
||||
expectDescriptorToSymbol,
|
||||
IrFactoryImpl,
|
||||
verifySignatures = true
|
||||
) {
|
||||
@@ -86,7 +82,6 @@ class FilePathsInKlibTest : CodegenTestCase() {
|
||||
nopack = false,
|
||||
jsOutputName = MODULE_NAME,
|
||||
icData = icData,
|
||||
expectDescriptorToSymbol = expectDescriptorToSymbol,
|
||||
moduleFragment = moduleFragment
|
||||
) { file ->
|
||||
metadataSerializer.serializeScope(file, module.jsFrontEndResult.bindingContext, moduleFragment.descriptor)
|
||||
|
||||
@@ -480,7 +480,7 @@ class GenerateIrRuntime {
|
||||
val irProviders = listOf(irLinker)
|
||||
|
||||
val psi2IrTranslator = Psi2IrTranslator(languageVersionSettings, psi2IrContext.configuration, messageLogger::checkNoUnboundSymbols)
|
||||
return psi2IrTranslator.generateModuleFragment(psi2IrContext, files, irProviders, emptyList(), null)
|
||||
return psi2IrTranslator.generateModuleFragment(psi2IrContext, files, irProviders, emptyList())
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalPathApi::class)
|
||||
@@ -500,7 +500,6 @@ class GenerateIrRuntime {
|
||||
tmpKlibDir,
|
||||
emptyList(),
|
||||
moduleFragment,
|
||||
mutableMapOf(),
|
||||
emptyList(),
|
||||
true,
|
||||
perFile,
|
||||
|
||||
@@ -8,7 +8,6 @@ package org.jetbrains.kotlin.incremental
|
||||
import org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport
|
||||
import org.jetbrains.kotlin.cli.js.klib.generateIrForKlibSerialization
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.ir.backend.js.*
|
||||
import org.jetbrains.kotlin.ir.backend.js.transformers.irToJs.JsGenerationGranularity
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl
|
||||
@@ -16,7 +15,6 @@ import org.jetbrains.kotlin.ir.linkage.partial.PartialLinkageConfig
|
||||
import org.jetbrains.kotlin.ir.linkage.partial.PartialLinkageLogLevel
|
||||
import org.jetbrains.kotlin.ir.linkage.partial.PartialLinkageMode
|
||||
import org.jetbrains.kotlin.ir.linkage.partial.setupPartialLinkageConfig
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||
import org.jetbrains.kotlin.serialization.js.ModuleKind
|
||||
import org.jetbrains.kotlin.test.TargetBackend
|
||||
import java.io.File
|
||||
@@ -95,7 +93,6 @@ abstract class IrAbstractInvalidationTest(
|
||||
|
||||
val moduleSourceFiles = (sourceModule.mainModule as MainModule.SourceFiles).files
|
||||
val icData = sourceModule.compilerConfiguration.incrementalDataProvider?.getSerializedData(moduleSourceFiles) ?: emptyList()
|
||||
val expectDescriptorToSymbol = mutableMapOf<DeclarationDescriptor, IrSymbol>()
|
||||
val (moduleFragment, _) = generateIrForKlibSerialization(
|
||||
environment.project,
|
||||
moduleSourceFiles,
|
||||
@@ -103,7 +100,6 @@ abstract class IrAbstractInvalidationTest(
|
||||
sourceModule.jsFrontEndResult.jsAnalysisResult,
|
||||
sortDependencies(sourceModule.moduleDependencies),
|
||||
icData,
|
||||
expectDescriptorToSymbol,
|
||||
IrFactoryImpl,
|
||||
verifySignatures = true
|
||||
) {
|
||||
@@ -118,7 +114,6 @@ abstract class IrAbstractInvalidationTest(
|
||||
nopack = false,
|
||||
jsOutputName = moduleName,
|
||||
icData = icData,
|
||||
expectDescriptorToSymbol = expectDescriptorToSymbol,
|
||||
moduleFragment = moduleFragment
|
||||
) { file ->
|
||||
metadataSerializer.serializeScope(file, sourceModule.jsFrontEndResult.bindingContext, moduleFragment.descriptor)
|
||||
|
||||
@@ -66,7 +66,6 @@ class FirJsKlibBackendFacade(
|
||||
klibPath = outputFile,
|
||||
libraries.map { it.library },
|
||||
inputArtifact.irModuleFragment,
|
||||
inputArtifact.expectDescriptorToSymbol,
|
||||
cleanFiles = inputArtifact.icData,
|
||||
nopack = true,
|
||||
perFile = false,
|
||||
|
||||
@@ -55,7 +55,6 @@ class JsKlibBackendFacade(
|
||||
klibPath = outputFile,
|
||||
JsEnvironmentConfigurator.getAllRecursiveLibrariesFor(module, testServices).keys.toList(),
|
||||
inputArtifact.irModuleFragment,
|
||||
inputArtifact.expectDescriptorToSymbol,
|
||||
cleanFiles = inputArtifact.icData,
|
||||
nopack = true,
|
||||
perFile = false,
|
||||
|
||||
-1
@@ -66,7 +66,6 @@ class FirWasmKlibBackendFacade(
|
||||
klibPath = outputFile,
|
||||
libraries.map { it.library },
|
||||
inputArtifact.irModuleFragment,
|
||||
inputArtifact.expectDescriptorToSymbol,
|
||||
cleanFiles = inputArtifact.icData,
|
||||
nopack = true,
|
||||
perFile = false,
|
||||
|
||||
Reference in New Issue
Block a user