[WASM] Fix invalid fields name section emit

This commit is contained in:
Igor Yakovlev
2022-06-15 18:51:15 +02:00
parent eb19d39cbf
commit bf575f73a2
@@ -168,9 +168,9 @@ class WasmIrToBinary(outputStream: OutputStream, val module: WasmModule, val mod
// Experimental fields name section
// https://github.com/WebAssembly/gc/issues/193
appendSection(10u) {
appendVectorSize(module.gcTypes.size)
module.gcTypes.forEach {
if (it is WasmStructDeclaration) {
val structDeclarations = module.gcTypes.filterIsInstance<WasmStructDeclaration>()
appendVectorSize(structDeclarations.size)
structDeclarations.forEach {
appendModuleFieldReference(it)
appendVectorSize(it.fields.size)
it.fields.forEachIndexed { index, field ->
@@ -181,7 +181,6 @@ class WasmIrToBinary(outputStream: OutputStream, val module: WasmModule, val mod
}
}
}
}
private fun appendInstr(instr: WasmInstr) {
val opcode = instr.operator.opcode