[Test] Use IrPluginContext for searching declarations for DUMP_EXTERNAL_CLASS check
This commit is contained in:
committed by
Space Team
parent
e7f6482857
commit
5d6cb2b691
@@ -444,7 +444,7 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
|
||||
val icData = environmentForJS.configuration.incrementalDataProvider?.getSerializedData(moduleSourceFiles) ?: emptyList()
|
||||
val expectDescriptorToSymbol = mutableMapOf<DeclarationDescriptor, IrSymbol>()
|
||||
|
||||
val moduleFragment = generateIrForKlibSerialization(
|
||||
val (moduleFragment, _) = generateIrForKlibSerialization(
|
||||
environmentForJS.project,
|
||||
moduleSourceFiles,
|
||||
environmentForJS.configuration,
|
||||
|
||||
@@ -12,6 +12,7 @@ package org.jetbrains.kotlin.cli.js.klib
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.kotlin.analyzer.AnalysisResult
|
||||
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
|
||||
import org.jetbrains.kotlin.backend.common.lower.ExpectDeclarationRemover
|
||||
import org.jetbrains.kotlin.backend.common.overrides.FakeOverrideChecker
|
||||
import org.jetbrains.kotlin.backend.common.serialization.DescriptorByIdSignatureFinderImpl
|
||||
@@ -55,7 +56,7 @@ fun generateIrForKlibSerialization(
|
||||
irFactory: IrFactory,
|
||||
verifySignatures: Boolean = true,
|
||||
getDescriptorByLibrary: (KotlinLibrary) -> ModuleDescriptor,
|
||||
): IrModuleFragment {
|
||||
): Pair<IrModuleFragment, IrPluginContext> {
|
||||
val errorPolicy = configuration.get(JSConfigurationKeys.ERROR_TOLERANCE_POLICY) ?: ErrorTolerancePolicy.DEFAULT
|
||||
val messageLogger = configuration.get(IrMessageLogger.IR_MESSAGE_LOGGER) ?: IrMessageLogger.None
|
||||
val allowUnboundSymbols = configuration[JSConfigurationKeys.PARTIAL_LINKAGE] ?: false
|
||||
@@ -90,7 +91,7 @@ fun generateIrForKlibSerialization(
|
||||
|
||||
sortedDependencies.map { irLinker.deserializeOnlyHeaderModule(getDescriptorByLibrary(it), it) }
|
||||
|
||||
val moduleFragment = psi2IrContext.generateModuleFragmentWithPlugins(
|
||||
val (moduleFragment, pluginContext) = psi2IrContext.generateModuleFragmentWithPlugins(
|
||||
project,
|
||||
files,
|
||||
irLinker,
|
||||
@@ -111,6 +112,6 @@ fun generateIrForKlibSerialization(
|
||||
moduleFragment.transform(ExpectDeclarationRemover(psi2IrContext.symbolTable, false), null)
|
||||
}
|
||||
|
||||
return moduleFragment
|
||||
return moduleFragment to pluginContext
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -371,7 +371,7 @@ object FirKotlinToJvmBytecodeCompiler {
|
||||
generationState.oldBEInitTrace(ktFiles)
|
||||
codegenFactory.generateModuleInFrontendIRMode(
|
||||
generationState, moduleFragment, components.symbolTable, components.irProviders,
|
||||
extensions, FirJvmBackendExtension(session, components)
|
||||
extensions, FirJvmBackendExtension(session, components), fir2IrResult.pluginContext
|
||||
) {
|
||||
performanceManager?.notifyIRLoweringFinished()
|
||||
performanceManager?.notifyIRGenerationStarted()
|
||||
|
||||
+10
-4
@@ -196,7 +196,7 @@ fun convertAnalyzedFirToIr(
|
||||
IrGenerationExtension.getInstances(it)
|
||||
} ?: emptyList()
|
||||
val linkViaSignatures = input.configuration.getBoolean(JVMConfigurationKeys.LINK_VIA_SIGNATURES)
|
||||
val (irModuleFragment, components) =
|
||||
val (irModuleFragment, components, pluginContext) =
|
||||
analysisResults.session.convertToIr(
|
||||
analysisResults.scopeSession, analysisResults.fir, extensions, irGenerationExtensions, linkViaSignatures
|
||||
)
|
||||
@@ -208,7 +208,8 @@ fun convertAnalyzedFirToIr(
|
||||
irModuleFragment,
|
||||
components.symbolTable,
|
||||
components,
|
||||
analysisResults.session
|
||||
analysisResults.session,
|
||||
pluginContext
|
||||
)
|
||||
}
|
||||
|
||||
@@ -247,8 +248,13 @@ fun generateCodeFromIr(
|
||||
|
||||
generationState.beforeCompile()
|
||||
codegenFactory.generateModuleInFrontendIRMode(
|
||||
generationState, input.irModuleFragment, input.symbolTable, input.components.irProviders, input.extensions,
|
||||
FirJvmBackendExtension(input.firSession, input.components)
|
||||
generationState,
|
||||
input.irModuleFragment,
|
||||
input.symbolTable,
|
||||
input.components.irProviders,
|
||||
input.extensions,
|
||||
FirJvmBackendExtension(input.firSession, input.components),
|
||||
input.pluginContext
|
||||
) {
|
||||
performanceManager?.notifyIRLoweringFinished()
|
||||
performanceManager?.notifyIRGenerationStarted()
|
||||
|
||||
+4
-2
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.diagnostics.impl.BaseDiagnosticsCollector
|
||||
import org.jetbrains.kotlin.fir.FirModuleData
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.backend.Fir2IrComponents
|
||||
import org.jetbrains.kotlin.fir.backend.Fir2IrPluginContext
|
||||
import org.jetbrains.kotlin.fir.backend.jvm.JvmFir2IrExtensions
|
||||
import org.jetbrains.kotlin.fir.declarations.FirFile
|
||||
import org.jetbrains.kotlin.fir.resolve.ScopeSession
|
||||
@@ -57,5 +58,6 @@ data class ModuleCompilerIrBackendInput(
|
||||
val irModuleFragment: IrModuleFragment,
|
||||
val symbolTable: SymbolTable,
|
||||
val components: Fir2IrComponents,
|
||||
val firSession: FirSession
|
||||
)
|
||||
val firSession: FirSession,
|
||||
val pluginContext: Fir2IrPluginContext
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user