From a090272bdb3c3a41c20fd9c46c310f948dea55e7 Mon Sep 17 00:00:00 2001 From: Sergej Jaskiewicz Date: Mon, 2 Sep 2024 18:24:25 +0300 Subject: [PATCH] [JS] Remove the helper that always returned true KT-70222 --- .../cli/common/arguments/K2JSCompilerArguments.kt | 14 ++------------ .../jetbrains/kotlin/daemon/CompileServiceImpl.kt | 2 +- .../incremental/IncrementalJsCompilerRunner.kt | 3 +-- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt index 2cbb7349c29e0..f8910e578ff2c 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt @@ -689,14 +689,12 @@ In combination with '-meta-info', this generates both IR and pre-IR versions of } override fun checkIrSupport(languageVersionSettings: LanguageVersionSettings, collector: MessageCollector) { - if (!isIrBackendEnabled()) return - if (languageVersionSettings.languageVersion < LanguageVersion.KOTLIN_1_4 || languageVersionSettings.apiVersion < ApiVersion.KOTLIN_1_4 ) { collector.report( CompilerMessageSeverity.ERROR, - "IR backend cannot be used with language or API version below 1.4" + "JS backend cannot be used with language or API version below 1.4" ) } } @@ -706,12 +704,7 @@ In combination with '-meta-info', this generates both IR and pre-IR versions of if (extensionFunctionsInExternals) { this[LanguageFeature.JsEnableExtensionFunctionInExternals] = LanguageFeature.State.ENABLED } - if (!isIrBackendEnabled()) { - this[LanguageFeature.JsAllowInvalidCharsIdentifiersEscaping] = LanguageFeature.State.DISABLED - } - if (isIrBackendEnabled()) { - this[LanguageFeature.JsAllowValueClassesInExternals] = LanguageFeature.State.ENABLED - } + this[LanguageFeature.JsAllowValueClassesInExternals] = LanguageFeature.State.ENABLED if (wasm) { this[LanguageFeature.JsAllowImplementingFunctionInterface] = LanguageFeature.State.ENABLED } @@ -720,6 +713,3 @@ In combination with '-meta-info', this generates both IR and pre-IR versions of override fun copyOf(): Freezable = copyK2JSCompilerArguments(this, K2JSCompilerArguments()) } - -fun K2JSCompilerArguments.isIrBackendEnabled(): Boolean = - irProduceKlibDir || irProduceJs || irProduceKlibFile || wasm || irBuildCache diff --git a/compiler/daemon/src/org/jetbrains/kotlin/daemon/CompileServiceImpl.kt b/compiler/daemon/src/org/jetbrains/kotlin/daemon/CompileServiceImpl.kt index 3b1bd4d8423f6..deb1f71462beb 100644 --- a/compiler/daemon/src/org/jetbrains/kotlin/daemon/CompileServiceImpl.kt +++ b/compiler/daemon/src/org/jetbrains/kotlin/daemon/CompileServiceImpl.kt @@ -600,7 +600,7 @@ abstract class CompileServiceImplBase( workingDir = workingDir, reporter = reporter, buildHistoryFile = incrementalCompilationOptions.multiModuleICSettings?.buildHistoryFile, - scopeExpansion = if (args.isIrBackendEnabled()) CompileScopeExpansionMode.ALWAYS else CompileScopeExpansionMode.NEVER, + scopeExpansion = CompileScopeExpansionMode.ALWAYS, modulesApiHistory = modulesApiHistory, icFeatures = incrementalCompilationOptions.icFeatures, ) diff --git a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJsCompilerRunner.kt b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJsCompilerRunner.kt index ebafab73b43bf..06d4e21387597 100644 --- a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJsCompilerRunner.kt +++ b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJsCompilerRunner.kt @@ -17,7 +17,6 @@ import org.jetbrains.kotlin.build.report.metrics.GradleBuildTime import org.jetbrains.kotlin.cli.common.ExitCode import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments -import org.jetbrains.kotlin.cli.common.arguments.isIrBackendEnabled import org.jetbrains.kotlin.cli.common.messages.MessageCollector import org.jetbrains.kotlin.cli.js.K2JSCompiler import org.jetbrains.kotlin.config.IncrementalCompilation @@ -94,7 +93,7 @@ class IncrementalJsCompilerRunner( get() = icFeatures.withAbiSnapshot override fun createCacheManager(icContext: IncrementalCompilationContext, args: K2JSCompilerArguments) = - IncrementalJsCachesManager(icContext, if (!args.isIrBackendEnabled()) JsSerializerProtocol else KlibMetadataSerializerProtocol, cacheDirectory) + IncrementalJsCachesManager(icContext, KlibMetadataSerializerProtocol, cacheDirectory) override fun destinationDir(args: K2JSCompilerArguments): File { return File(args.outputDir!!)