[Wasm] Don't print "field" for array types in wat

This commit is contained in:
Zalim Bashorov
2023-07-19 17:01:58 +02:00
committed by Space Team
parent 8d440a61e2
commit 8a9531ce3c
@@ -306,7 +306,7 @@ class WasmIrToText : SExpressionBuilder() {
newLineList("type") { newLineList("type") {
appendModuleFieldReference(type) appendModuleFieldReference(type)
sameLineList("array") { sameLineList("array") {
appendStructField(type.field) appendFieldType(type.field)
} }
} }
} }
@@ -511,13 +511,17 @@ class WasmIrToText : SExpressionBuilder() {
private fun appendStructField(field: WasmStructFieldDeclaration) { private fun appendStructField(field: WasmStructFieldDeclaration) {
sameLineList("field") { sameLineList("field") {
appendFieldType(field)
}
}
private fun appendFieldType(field: WasmStructFieldDeclaration) {
if (field.isMutable) { if (field.isMutable) {
sameLineList("mut") { appendType(field.type) } sameLineList("mut") { appendType(field.type) }
} else { } else {
appendType(field.type) appendType(field.type)
} }
} }
}
fun appendLocalReference(local: WasmLocal) { fun appendLocalReference(local: WasmLocal) {
appendElement("$${local.id}_${sanitizeWatIdentifier(local.name)}") appendElement("$${local.id}_${sanitizeWatIdentifier(local.name)}")