summaryrefslogtreecommitdiff
path: root/test/passes/legalize-js-interface_all-features.wast
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2019-12-30 17:55:20 -0800
committerGitHub <noreply@github.com>2019-12-30 17:55:20 -0800
commitbcc76146fed433cbc8ba01a9f568d979c145110b (patch)
treeab70ad24afc257b73513c3e62f3aab9938d05944 /test/passes/legalize-js-interface_all-features.wast
parenta30f1df5696ccb3490e2eaa3a9ed5e7e487c7b0e (diff)
downloadbinaryen-bcc76146fed433cbc8ba01a9f568d979c145110b.tar.gz
binaryen-bcc76146fed433cbc8ba01a9f568d979c145110b.tar.bz2
binaryen-bcc76146fed433cbc8ba01a9f568d979c145110b.zip
Add support for reference types proposal (#2451)
This adds support for the reference type proposal. This includes support for all reference types (`anyref`, `funcref`(=`anyfunc`), and `nullref`) and four new instructions: `ref.null`, `ref.is_null`, `ref.func`, and new typed `select`. This also adds subtype relationship support between reference types. This does not include table instructions yet. This also does not include wasm2js support. Fixes #2444 and fixes #2447.
Diffstat (limited to 'test/passes/legalize-js-interface_all-features.wast')
-rw-r--r--test/passes/legalize-js-interface_all-features.wast31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/passes/legalize-js-interface_all-features.wast b/test/passes/legalize-js-interface_all-features.wast
new file mode 100644
index 000000000..4697a8f18
--- /dev/null
+++ b/test/passes/legalize-js-interface_all-features.wast
@@ -0,0 +1,31 @@
+(module
+ (import "env" "imported" (func $imported (result i64)))
+ (import "env" "other" (func $other (param i32) (param i64) (param i64)))
+ (import "env" "ref-func-arg" (func $ref-func-arg (result i64)))
+ (export "func" (func $func))
+ (export "ref-func-test" (func $ref-func-test))
+ (export "imported" (func $imported))
+ (export "imported_again" (func $imported))
+ (export "other" (func $other))
+ (func $func (result i64)
+ (drop (call $imported))
+ (call $other
+ (i32.const 0)
+ (i64.const 0)
+ (i64.const 0)
+ )
+ (unreachable)
+ )
+
+ ;; If an import is used in ref.func, even if it is legalized to another
+ ;; import, the original import should not be removed.
+ (func $ref-func-test
+ (drop
+ (call $ref-func-arg)
+ )
+ (drop
+ (ref.func $ref-func-arg)
+ )
+ )
+)
+(module)