Revert metadata version reading advancement for JS/Common

This commit reverts 59e2101a25 partially,
leaving only the implementation of KT-25972 for JVM. The reason is that
we can't fully commit to stabilizing JS (and .kotlin_metadata) binary
metadata formats so much as to postpone any changes done to it for a
whole release year time. It's likely that we will need to update JS
metadata format incompatibly pretty soon, and with the scheme where we
can read the "current + 1" version, it'd require advancing the metadata
version by 2, which would break the nice property that the metadata
version (since Kotlin 1.4) is equal to the version of the compiler that
produced it.

See KT-25972
This commit is contained in:
Alexander Udalov
2018-08-24 19:10:17 +02:00
parent 4067d6b196
commit afd53c9870
5 changed files with 11 additions and 12 deletions
@@ -27,7 +27,7 @@ class KotlinJavascriptMetadata(val version: JsMetadataVersion, val moduleName: S
// TODO: move to JS modules
class JsMetadataVersion(vararg numbers: Int) : BinaryVersion(*numbers) {
override fun isCompatible(): Boolean =
isMetadataVersionCompatible()
this.isCompatibleTo(INSTANCE)
fun toInteger() = (patch shl 16) + (minOf(minor, 255) shl 8) + minOf(major, 255)