Skip to content

Commit

Permalink
[JS] Remove the helper that always returned true
Browse files Browse the repository at this point in the history
KT-70222
  • Loading branch information
broadwaylamb authored and qodana-bot committed Sep 3, 2024
1 parent 8c2df4e commit a090272
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
}
}
Expand All @@ -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
}
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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!!)
Expand Down

0 comments on commit a090272

Please sign in to comment.