[WASM] Fix invalid fields name section emit
This commit is contained in:
@@ -168,15 +168,14 @@ class WasmIrToBinary(outputStream: OutputStream, val module: WasmModule, val mod
|
|||||||
// Experimental fields name section
|
// Experimental fields name section
|
||||||
// https://github.com/WebAssembly/gc/issues/193
|
// https://github.com/WebAssembly/gc/issues/193
|
||||||
appendSection(10u) {
|
appendSection(10u) {
|
||||||
appendVectorSize(module.gcTypes.size)
|
val structDeclarations = module.gcTypes.filterIsInstance<WasmStructDeclaration>()
|
||||||
module.gcTypes.forEach {
|
appendVectorSize(structDeclarations.size)
|
||||||
if (it is WasmStructDeclaration) {
|
structDeclarations.forEach {
|
||||||
appendModuleFieldReference(it)
|
appendModuleFieldReference(it)
|
||||||
appendVectorSize(it.fields.size)
|
appendVectorSize(it.fields.size)
|
||||||
it.fields.forEachIndexed { index, field ->
|
it.fields.forEachIndexed { index, field ->
|
||||||
b.writeVarUInt32(index)
|
b.writeVarUInt32(index)
|
||||||
b.writeString(field.name)
|
b.writeString(field.name)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user