summaryrefslogtreecommitdiff
path: root/test/example/c-api-kitchen-sink.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/example/c-api-kitchen-sink.c')
-rw-r--r--test/example/c-api-kitchen-sink.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c
index a6a196ae6..93a6281f8 100644
--- a/test/example/c-api-kitchen-sink.c
+++ b/test/example/c-api-kitchen-sink.c
@@ -973,7 +973,7 @@ void test_core() {
// All the rest
BinaryenBlock(module, NULL, NULL, 0, -1), // block with no name and no type
BinaryenIf(module, temp1, temp2, temp3),
- BinaryenIf(module, temp4, temp5, NULL),
+ BinaryenIf(module, temp4, BinaryenDrop(module, temp5), NULL),
BinaryenLoop(module, "in", makeInt32(module, 0)),
BinaryenLoop(module, NULL, makeInt32(module, 0)),
BinaryenBreak(module, "the-value", temp6, temp7),
@@ -1232,6 +1232,14 @@ void test_core() {
BinaryenExpressionPrint(
valueList[3]); // test printing a standalone expression
+ // Add drops of concrete expressions
+ for (int i = 0; i < sizeof(valueList) / sizeof(valueList[0]); ++i) {
+ BinaryenType type = BinaryenExpressionGetType(valueList[i]);
+ if (type != BinaryenTypeNone() && type != BinaryenTypeUnreachable()) {
+ valueList[i] = BinaryenDrop(module, valueList[i]);
+ }
+ }
+
// Make the main body of the function. and one block with a return value, one
// without
BinaryenExpressionRef value =
@@ -1360,9 +1368,6 @@ void test_core() {
BinaryenNop(module));
BinaryenSetStart(module, starter);
- // A bunch of our code needs drop(), auto-add it
- BinaryenModuleAutoDrop(module);
-
BinaryenFeatures features = BinaryenFeatureAll();
BinaryenModuleSetFeatures(module, features);
assert(BinaryenModuleGetFeatures(module) == features);