WASM: Implement simple try/catch codegen

This commit is contained in:
Igor Laevsky
2021-08-18 15:57:07 +03:00
committed by TeamCityServer
parent 6ca965af6f
commit 02aed80e18
5 changed files with 60 additions and 5 deletions
@@ -76,6 +76,12 @@ abstract class WasmExpressionBuilder {
buildInstr(WasmOp.THROW, WasmImmediate.TagIdx(tagIdx))
}
@Suppress("UNUSED_PARAMETER")
fun buildTry(label: String?, resultType: WasmType? = null) {
numberOfNestedBlocks++
buildInstr(WasmOp.TRY, WasmImmediate.BlockType.Value(resultType))
}
fun buildCatch(tagIdx: Int) {
buildInstr(WasmOp.CATCH, WasmImmediate.TagIdx(tagIdx))
}