summaryrefslogtreecommitdiff
path: root/examples/wasm/call.wat
diff options
context:
space:
mode:
authorHenry Gressmann <mail@henrygressmann.de>2023-12-10 00:49:02 +0100
committerHenry Gressmann <mail@henrygressmann.de>2023-12-10 00:49:02 +0100
commitaa2cbdc66cb2df1fb901164f880d2389f74d438c (patch)
tree84b7cce9e5468110be6ea31e2581c6aacab448d2 /examples/wasm/call.wat
parent085c117cc0de0bb9ae90d4cbe65090ed53189b70 (diff)
feat: function calls
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Diffstat (limited to 'examples/wasm/call.wat')
-rw-r--r--examples/wasm/call.wat16
1 files changed, 16 insertions, 0 deletions
diff --git a/examples/wasm/call.wat b/examples/wasm/call.wat
new file mode 100644
index 0000000..247b976
--- /dev/null
+++ b/examples/wasm/call.wat
@@ -0,0 +1,16 @@
+(module
+ (func $add_fn (param $a i32) (param $b i32) (result i32)
+ local.get $a
+ local.get $b
+ i32.add
+ )
+
+ (func $add (param $x i32) (param $y i32) (result i32)
+ local.get $x
+ local.get $y
+ call $add_fn
+ )
+
+ (export "add" (func $add))
+)
+