Cleanup: Use concrete subclass instead of BinaryVersion when possible
Review: https://jetbrains.team/p/kt/reviews/8401 BinaryVersion is a problematic class, because it doesn't represent any logical entity in the codebase, it's just a way to reuse common logic for Kotlin versions. But unfortunately, BinaryVersion is used in a lot of API definitions, which makes code hard to read because it's not obvious which subclasses are supposed to be passed in the particular API.
This commit is contained in:
@@ -243,6 +243,9 @@ class K2JSTranslator @JvmOverloads constructor(
|
||||
scope: Collection<DeclarationDescriptor>
|
||||
): ProtoBuf.PackageFragment {
|
||||
val metadataVersion = config.configuration.get(CommonConfigurationKeys.METADATA_VERSION)
|
||||
if (metadataVersion !is JsMetadataVersion?) {
|
||||
error("${metadataVersion?.let { it::class }} must be either null or ${JsMetadataVersion::class.simpleName}")
|
||||
}
|
||||
return KotlinJavascriptSerializationUtil.serializeDescriptors(
|
||||
bindingContext,
|
||||
moduleDescriptor,
|
||||
|
||||
Reference in New Issue
Block a user