summaryrefslogtreecommitdiff
path: root/test/wasm2js/tables.wast
diff options
context:
space:
mode:
Diffstat (limited to 'test/wasm2js/tables.wast')
-rw-r--r--test/wasm2js/tables.wast46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/wasm2js/tables.wast b/test/wasm2js/tables.wast
new file mode 100644
index 000000000..56e85e40d
--- /dev/null
+++ b/test/wasm2js/tables.wast
@@ -0,0 +1,46 @@
+(module
+ (import "env" "table" (table $table 7 funcref))
+
+ (elem (i32.const 1) $table.get)
+
+ (func $table.get (export "table.get") (result funcref)
+ (table.get $table
+ (i32.const 1)
+ )
+ )
+
+ (func $table.set (export "table.set")
+ (table.set $table
+ (i32.const 1)
+ (ref.func $table.set)
+ )
+ )
+
+ (func $table.size (export "table.size") (result i32)
+ (table.size $table)
+ )
+
+ (func $table.grow (export "table.grow") (result i32)
+ (table.grow $table
+ (ref.func $table.grow)
+ (i32.const 42)
+ )
+ )
+
+ (func $table.fill (export "table.fill") (param $dest i32) (param $value funcref) (param $size i32)
+ (table.fill $table
+ (local.get $dest)
+ (local.get $value)
+ (local.get $size)
+ )
+ )
+
+ (func $table.copy (export "table.copy") (param $dest i32) (param $source i32) (param $size i32)
+ (table.copy $table $table
+ (local.get $dest)
+ (local.get $source)
+ (local.get $size)
+ )
+ )
+)
+