[Wasm] Always use -0x30/sub when defining a struct type

Otherwise, according to the spec, a type will be treated as a final,
which is not correct in many cases.
Later, we can generate final struct types when it's applicable.

#KT-60200 Fixed
This commit is contained in:
Zalim Bashorov
2023-07-14 14:15:15 +02:00
parent 5db493a475
commit 1cf3841588
@@ -320,12 +320,16 @@ class WasmIrToBinary(
}
private fun appendStructTypeDeclaration(type: WasmStructDeclaration) {
b.writeVarInt7(-0x30)
val superType = type.superType
if (superType != null) {
b.writeVarInt7(-0x30)
appendVectorSize(1)
appendModuleFieldReference(superType.owner)
} else {
appendVectorSize(0)
}
b.writeVarInt7(-0x21)
b.writeVarUInt32(type.fields.size)
type.fields.forEach {