summaryrefslogtreecommitdiff
path: root/test/reference-types.wast
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2021-03-04 20:31:58 +0000
committerGitHub <noreply@github.com>2021-03-04 12:31:58 -0800
commit2bd5f60769506479316811da2b07913d0412abe0 (patch)
tree1477b7adda76385f219736946cf89c20307a289e /test/reference-types.wast
parentecd05546466494973fcc196a6661e0d5dfff6aa1 (diff)
downloadbinaryen-2bd5f60769506479316811da2b07913d0412abe0.tar.gz
binaryen-2bd5f60769506479316811da2b07913d0412abe0.tar.bz2
binaryen-2bd5f60769506479316811da2b07913d0412abe0.zip
Emit "elem declare" for functions that need it (#3653)
This adds support for reading (elem declare func $foo .. in the text and binary formats. We can simply ignore it: we don't need to represent it in IR, rather we find what needs to be declared when writing. That part takes a little more work, for which this adds a shared helper function.
Diffstat (limited to 'test/reference-types.wast')
-rw-r--r--test/reference-types.wast10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/reference-types.wast b/test/reference-types.wast
index e79508839..28e24b4d7 100644
--- a/test/reference-types.wast
+++ b/test/reference-types.wast
@@ -17,6 +17,7 @@
(func $foo)
(table funcref (elem $take_externref $take_funcref $take_anyref))
+ (elem declare func $ref-taken-but-not-in-table)
(import "env" "import_func" (func $import_func (param externref) (result funcref)))
(import "env" "import_global" (global $import_global externref))
@@ -532,4 +533,13 @@
(return (ref.func $foo))
(return (ref.null func))
)
+
+ (func $ref-user
+ (drop
+ ;; an "elem declare func" must be emitted for this ref.func which is not
+ ;; in the table
+ (ref.func $ref-taken-but-not-in-table)
+ )
+ )
+ (func $ref-taken-but-not-in-table)
)