(module
(type $ft (;0;) (func))
(type $st (;1;) (struct))
(type $at (;2;) (array i8))
(type (;3;) (func (param externref)))
(type (;4;) (func (param i32)))
(table (;0;) 10 anyref)
(export "init" (func 1))
(export "ref_cast_non_null" (func 2))
(export "ref_cast_null" (func 3))
(export "ref_cast_i31" (func 4))
(export "ref_cast_struct" (func 5))
(export "ref_cast_array" (func 6))
(elem (;0;) declare func $f)
(func $f (;0;) (type $ft))
(func (;1;) (type 3) (param $x externref)
i32.const 0
;; [i32]
ref.null any
;; [i32 anyref]
table.set 0
;; []
i32.const 1
;; [i32]
i32.const 7
;; [i32 i32]
ref.i31
;; [i32 (ref i31)]
table.set 0
;; []
i32.const 2
;; [i32]
struct.new_default $st
;; [i32 (ref (id 1))]
table.set 0
;; []
i32.const 3
;; [i32]
i32.const 0
;; [i32 i32]
array.new_default $at
;; [i32 (ref (id 2))]
table.set 0
;; []
i32.const 4
;; [i32]
local.get $x
;; [i32 externref]
any.convert_extern
;; [i32 anyref]
table.set 0
;; []
i32.const 5
;; [i32]
ref.null i31
;; [i32 i31ref]
table.set 0
;; []
i32.const 6
;; [i32]
ref.null struct
;; [i32 structref]
table.set 0
;; []
i32.const 7
;; [i32]
ref.null none
;; [i32 nullref]
table.set 0
;; []
)
(func (;2;) (type 4) (param $i i32)
local.get $i
;; [i32]
table.get 0
;; [anyref]
ref.as_non_null
;; [(ref any)]
drop
;; []
local.get $i
;; [i32]
table.get 0
;; [anyref]
ref.cast anyref
;; [anyref]
drop
;; []
)
(func (;3;) (type 4) (param $i i32)
local.get $i
;; [i32]
table.get 0
;; [anyref]
ref.cast anyref
;; [anyref]
drop
;; []
local.get $i
;; [i32]
table.get 0
;; [anyref]
ref.cast structref
;; [structref]
drop
;; []
local.get $i
;; [i32]
table.get 0
;; [anyref]
ref.cast arrayref
;; [arrayref]
drop
;; []
local.get $i
;; [i32]
table.get 0
;; [anyref]
ref.cast i31ref
;; [i31ref]
drop
;; []
local.get $i
;; [i32]
table.get 0
;; [anyref]
ref.cast nullref
;; [nullref]
drop
;; []
)
(func (;4;) (type 4) (param $i i32)
local.get $i
;; [i32]
table.get 0
;; [anyref]
ref.cast (ref i31)
;; [(ref i31)]
drop
;; []
local.get $i
;; [i32]
table.get 0
;; [anyref]
ref.cast i31ref
;; [i31ref]
drop
;; []
)
(func (;5;) (type 4) (param $i i32)
local.get $i
;; [i32]
table.get 0
;; [anyref]
ref.cast (ref struct)
;; [(ref struct)]
drop
;; []
local.get $i
;; [i32]
table.get 0
;; [anyref]
ref.cast structref
;; [structref]
drop
;; []
)
(func (;6;) (type 4) (param $i i32)
local.get $i
;; [i32]
table.get 0
;; [anyref]
ref.cast (ref array)
;; [(ref array)]
drop
;; []
local.get $i
;; [i32]
table.get 0
;; [anyref]
ref.cast arrayref
;; [arrayref]
drop
;; []
)
)