From 98cef80eabe2171bb3076767d68b25a85d268c12 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Wed, 20 Dec 2023 17:38:40 -0800 Subject: Unify method pairs with and without Type param (#6184) As suggested in https://github.com/WebAssembly/binaryen/pull/6181#discussion_r1427188670, using `std::optional`, this unifies two different versions of `make***`, for block-like structures (`block`, `if`, `loop`, `try`, and `try_table`) with and without a type parameter. This also allows unifying of `finalize` methods, with and without a type. This also sets `breakability` argument of `Block::finalize` to `Unknown` so we can only have one `Block::finalize` that handles all cases. This also adds an optional `std::optional type` parameter to `blockifyWithName`, and `makeSequence` functions in `wasm-builder.h`. blockify was not included because it has a variadic parameter. --- test/example/stack-utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/example/stack-utils.cpp b/test/example/stack-utils.cpp index f8824e5cb..e393e13e3 100644 --- a/test/example/stack-utils.cpp +++ b/test/example/stack-utils.cpp @@ -24,7 +24,7 @@ void test_remove_nops() { builder.makeNop(), builder.makeNop(), }, - {Type::i32, Type::i64}); + Type{Type::i32, Type::i64}); std::cout << *block << '\n'; StackUtils::removeNops(block); std::cout << *block << '\n'; -- cgit v1.2.3