[JVM_IR] Don't use irPluginContext at all when compiling code fragment

This is an extended version of the fix in
57d912a5d4. We don't want to use any
plugins in code fragment compilation, but we still get them through
`project` because they are registered in IDEA. So we just fully
exclude `irPluginContext`.

#KT-63695 Fixed
This commit is contained in:
Ivan Kylchik
2023-11-29 16:38:58 +01:00
committed by Space Team
parent 814bf1b80d
commit 73a0b4eaf2
2 changed files with 4 additions and 4 deletions
@@ -116,7 +116,7 @@ open class JvmIrCodegenFactory(
val irProviders: List<IrProvider>, val irProviders: List<IrProvider>,
val extensions: JvmGeneratorExtensions, val extensions: JvmGeneratorExtensions,
val backendExtension: JvmBackendExtension, val backendExtension: JvmBackendExtension,
val pluginContext: IrPluginContext, val pluginContext: IrPluginContext?,
val notifyCodegenStart: () -> Unit val notifyCodegenStart: () -> Unit
) : CodegenFactory.BackendInput ) : CodegenFactory.BackendInput
@@ -212,8 +212,8 @@ open class JvmIrCodegenFactory(
psi2irContext.irBuiltIns, psi2irContext.irBuiltIns,
irLinker, irLinker,
messageLogger messageLogger
) ).takeIf { !ideCodegenSettings.shouldStubAndNotLinkUnboundSymbols }
if (pluginExtensions.isNotEmpty() && !ideCodegenSettings.shouldStubAndNotLinkUnboundSymbols) { if (pluginExtensions.isNotEmpty() && pluginContext != null) {
for (extension in pluginExtensions) { for (extension in pluginExtensions) {
if (psi2irContext.configuration.generateBodies || if (psi2irContext.configuration.generateBodies ||
@OptIn(FirIncompatiblePluginAPI::class) extension.shouldAlsoBeAppliedInKaptStubGenerationMode @OptIn(FirIncompatiblePluginAPI::class) extension.shouldAlsoBeAppliedInKaptStubGenerationMode
@@ -115,7 +115,7 @@ sealed class IrBackendInput : ResultingArtifact.BackendInput<IrBackendInput>() {
get() = backendInput.irModuleFragment get() = backendInput.irModuleFragment
override val irPluginContext: IrPluginContext override val irPluginContext: IrPluginContext
get() = backendInput.pluginContext get() = backendInput.pluginContext!!
override val diagnosticReporter: BaseDiagnosticsCollector override val diagnosticReporter: BaseDiagnosticsCollector
get() = state.diagnosticReporter as BaseDiagnosticsCollector get() = state.diagnosticReporter as BaseDiagnosticsCollector