Extract & use GenerationState.metadataVersion helper
This commit is contained in:
@@ -33,6 +33,7 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticSink
|
||||
import org.jetbrains.kotlin.idea.MainFunctionDetector
|
||||
import org.jetbrains.kotlin.load.java.components.JavaDeprecationSettings
|
||||
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
|
||||
import org.jetbrains.kotlin.metadata.deserialization.BinaryVersion
|
||||
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmMetadataVersion
|
||||
import org.jetbrains.kotlin.modules.TargetId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
@@ -346,9 +347,7 @@ class GenerationState private constructor(
|
||||
|
||||
val disableOptimization = configuration.get(JVMConfigurationKeys.DISABLE_OPTIMIZATION, false)
|
||||
|
||||
val metadataVersion =
|
||||
configuration.get(CommonConfigurationKeys.METADATA_VERSION)
|
||||
?: LANGUAGE_TO_METADATA_VERSION.getValue(languageVersionSettings.languageVersion)
|
||||
val metadataVersion = metadataVersion(configuration)
|
||||
|
||||
val abiStability = configuration.get(JVMConfigurationKeys.ABI_STABILITY)
|
||||
|
||||
@@ -460,6 +459,14 @@ class GenerationState private constructor(
|
||||
"in `GenerationState.LANGUAGE_TO_METADATA_VERSION`"
|
||||
}
|
||||
}
|
||||
|
||||
fun metadataVersion(
|
||||
configuration: CompilerConfiguration,
|
||||
languageVersionSettings: LanguageVersionSettings = configuration.languageVersionSettings
|
||||
): BinaryVersion {
|
||||
return configuration.get(CommonConfigurationKeys.METADATA_VERSION)
|
||||
?: LANGUAGE_TO_METADATA_VERSION.getValue(languageVersionSettings.languageVersion)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -609,9 +609,7 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
|
||||
// TODO: expect -> actual mapping
|
||||
val expectDescriptorToSymbol = mutableMapOf<DeclarationDescriptor, IrSymbol>()
|
||||
|
||||
val metadataVersion =
|
||||
configuration.get(CommonConfigurationKeys.METADATA_VERSION)
|
||||
?: GenerationState.LANGUAGE_TO_METADATA_VERSION.getValue(configuration.languageVersionSettings.languageVersion)
|
||||
val metadataVersion = GenerationState.metadataVersion(configuration)
|
||||
|
||||
serializeModuleIntoKlib(
|
||||
configuration[CommonConfigurationKeys.MODULE_NAME]!!,
|
||||
|
||||
+1
-2
@@ -92,8 +92,7 @@ fun makeLocalFirMetadataSerializerForMetadataSource(
|
||||
configuration.getBoolean(JVMConfigurationKeys.DISABLE_PARAM_ASSERTIONS),
|
||||
session.languageVersionSettings.apiVersion >= ApiVersion.KOTLIN_1_4 &&
|
||||
!configuration.getBoolean(JVMConfigurationKeys.NO_UNIFIED_NULL_CHECKS),
|
||||
configuration.get(CommonConfigurationKeys.METADATA_VERSION)
|
||||
?: GenerationState.LANGUAGE_TO_METADATA_VERSION.getValue(session.languageVersionSettings.languageVersion),
|
||||
GenerationState.metadataVersion(configuration, session.languageVersionSettings),
|
||||
session.languageVersionSettings.getFlag(JvmAnalysisFlags.jvmDefaultMode),
|
||||
stringTable
|
||||
)
|
||||
|
||||
+1
-3
@@ -76,9 +76,7 @@ class Fir2IrJsResultsConverter(
|
||||
|
||||
val icData = configuration.incrementalDataProvider?.getSerializedData(sourceFiles) ?: emptyList()
|
||||
val expectDescriptorToSymbol = mutableMapOf<DeclarationDescriptor, IrSymbol>()
|
||||
val metadataVersion =
|
||||
configuration.get(CommonConfigurationKeys.METADATA_VERSION)
|
||||
?: GenerationState.LANGUAGE_TO_METADATA_VERSION.getValue(module.languageVersionSettings.languageVersion)
|
||||
val metadataVersion = GenerationState.metadataVersion(configuration, module.languageVersionSettings)
|
||||
|
||||
// At this point, checkers will already have been run by a previous test step. `runCheckers` returns the cached diagnostics map.
|
||||
val diagnosticsMap = inputArtifact.partsForDependsOnModules.last().firAnalyzerFacade.runCheckers()
|
||||
|
||||
Reference in New Issue
Block a user