[Wasm] Don't print recursion group in wat when it's empty

This commit is contained in:
Zalim Bashorov
2023-07-19 20:44:09 +02:00
committed by Space Team
parent 590400071b
commit 8a645e9c0a
@@ -228,18 +228,22 @@ class WasmIrToText : SExpressionBuilder() {
with(module) { with(module) {
newLineList("module") { newLineList("module") {
functionTypes.forEach { appendFunctionTypeDeclaration(it) } functionTypes.forEach { appendFunctionTypeDeclaration(it) }
newLineList("rec") {
recGroupTypes.forEach { if(recGroupTypes.isNotEmpty()) {
when (it) { newLineList("rec") {
is WasmStructDeclaration -> recGroupTypes.forEach {
appendStructTypeDeclaration(it) when (it) {
is WasmArrayDeclaration -> is WasmStructDeclaration ->
appendArrayTypeDeclaration(it) appendStructTypeDeclaration(it)
is WasmFunctionType -> is WasmArrayDeclaration ->
appendFunctionTypeDeclaration(it) appendArrayTypeDeclaration(it)
is WasmFunctionType ->
appendFunctionTypeDeclaration(it)
}
} }
} }
} }
importsInOrder.forEach { importsInOrder.forEach {
when (it) { when (it) {
is WasmFunction.Imported -> appendImportedFunction(it) is WasmFunction.Imported -> appendImportedFunction(it)