summaryrefslogtreecommitdiff
path: root/test/example/c-api-kitchen-sink.c
diff options
context:
space:
mode:
authorMax Graey <maxgraey@gmail.com>2021-10-07 22:43:30 +0300
committerGitHub <noreply@github.com>2021-10-07 12:43:30 -0700
commit2dff27c086e8f2a9913096ebf3dc93e97051d85a (patch)
tree3d689a659ad2339639fc4b2e73753b51e6d9295c /test/example/c-api-kitchen-sink.c
parentff68bca64cd669aff59c7e1cc0a6677d267a410f (diff)
downloadbinaryen-2dff27c086e8f2a9913096ebf3dc93e97051d85a.tar.gz
binaryen-2dff27c086e8f2a9913096ebf3dc93e97051d85a.tar.bz2
binaryen-2dff27c086e8f2a9913096ebf3dc93e97051d85a.zip
Add table.set operation (#4215)
Diffstat (limited to 'test/example/c-api-kitchen-sink.c')
-rw-r--r--test/example/c-api-kitchen-sink.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c
index 5db1d28dc..894fc1454 100644
--- a/test/example/c-api-kitchen-sink.c
+++ b/test/example/c-api-kitchen-sink.c
@@ -1012,6 +1012,20 @@ void test_core() {
BinaryenAddPassiveElementSegment(module, "p2", funcNames, 1);
BinaryenRemoveElementSegment(module, "p2");
+ BinaryenExpressionRef funcrefExpr1 =
+ BinaryenRefFunc(module, "kitchen()sinker", BinaryenTypeFuncref());
+
+ BinaryenExpressionPrint(BinaryenTableSet(
+ module, "0", BinaryenConst(module, BinaryenLiteralInt32(0)), funcrefExpr1));
+
+ BinaryenExpressionRef funcrefExpr2 =
+ BinaryenTableGet(module,
+ "0",
+ BinaryenConst(module, BinaryenLiteralInt32(0)),
+ BinaryenTypeFuncref());
+
+ BinaryenExpressionPrint(funcrefExpr2);
+
// Memory. One per module
const char* segments[] = {"hello, world", "I am passive"};