| 1 |
;; RUN: print --print-operand-stack % |
| 2 |
|
| 3 |
(module |
| 4 |
(type $ft (func)) |
| 5 |
(type $st (struct)) |
| 6 |
(type $at (array i8)) |
| 7 |
|
| 8 |
(table 10 anyref) |
| 9 |
|
| 10 |
(elem declare func $f) |
| 11 |
(func $f) |
| 12 |
|
| 13 |
(func (export "init") (param $x externref) |
| 14 |
(table.set (i32.const 0) (ref.null any)) |
| 15 |
(table.set (i32.const 1) (ref.i31 (i32.const 7))) |
| 16 |
(table.set (i32.const 2) (struct.new_default $st)) |
| 17 |
(table.set (i32.const 3) (array.new_default $at (i32.const 0))) |
| 18 |
(table.set (i32.const 4) (any.convert_extern (local.get $x))) |
| 19 |
(table.set (i32.const 5) (ref.null i31)) |
| 20 |
(table.set (i32.const 6) (ref.null struct)) |
| 21 |
(table.set (i32.const 7) (ref.null none)) |
| 22 |
) |
| 23 |
|
| 24 |
(func (export "ref_cast_non_null") (param $i i32) |
| 25 |
(drop (ref.as_non_null (table.get (local.get $i)))) |
| 26 |
(drop (ref.cast (ref null any) (table.get (local.get $i)))) |
| 27 |
) |
| 28 |
(func (export "ref_cast_null") (param $i i32) |
| 29 |
(drop (ref.cast anyref (table.get (local.get $i)))) |
| 30 |
(drop (ref.cast structref (table.get (local.get $i)))) |
| 31 |
(drop (ref.cast arrayref (table.get (local.get $i)))) |
| 32 |
(drop (ref.cast i31ref (table.get (local.get $i)))) |
| 33 |
(drop (ref.cast nullref (table.get (local.get $i)))) |
| 34 |
) |
| 35 |
(func (export "ref_cast_i31") (param $i i32) |
| 36 |
(drop (ref.cast (ref i31) (table.get (local.get $i)))) |
| 37 |
(drop (ref.cast i31ref (table.get (local.get $i)))) |
| 38 |
) |
| 39 |
(func (export "ref_cast_struct") (param $i i32) |
| 40 |
(drop (ref.cast (ref struct) (table.get (local.get $i)))) |
| 41 |
(drop (ref.cast structref (table.get (local.get $i)))) |
| 42 |
) |
| 43 |
(func (export "ref_cast_array") (param $i i32) |
| 44 |
(drop (ref.cast (ref array) (table.get (local.get $i)))) |
| 45 |
(drop (ref.cast arrayref (table.get (local.get $i)))) |
| 46 |
) |
| 47 |
) |