You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.1 KiB
39 lines
1.1 KiB
(module
|
|
|
|
(type $t1 (array (mut i32)))
|
|
(type $t2 (array (mut i31ref)))
|
|
(type $tpair (struct
|
|
(field $left (ref $t1))
|
|
(field $right (ref $t2))))
|
|
|
|
(func $f
|
|
(local $array1 (ref $t1))
|
|
(local $array2 (ref $t2))
|
|
(local $pair (ref $tpair)) (local $x i32)
|
|
|
|
(array.new $t1 (i32.const 0) (i32.const 3))
|
|
(local.set $array1)
|
|
(array.set $t1 (local.get $array1)
|
|
(i32.const 0) (i32.const 1))
|
|
(array.set $t1 (local.get $array1)
|
|
(i32.const 1) (i32.const 2))
|
|
(array.set $t1 (local.get $array1)
|
|
(i32.const 2) (i32.const 3))
|
|
|
|
(array.new $t2 (i31.new (i32.const 0)) (i32.const 3))
|
|
(local.set $array2)
|
|
(array.set $t2 (local.get $array2) (i32.const 0)
|
|
(i31.new (i32.const 42)))
|
|
(array.set $t2 (local.get $array2) (i32.const 1)
|
|
(i31.new (i32.const 99)))
|
|
(array.set $t2 (local.get $array2) (i32.const 2)
|
|
(i31.new (i32.const 666)))
|
|
|
|
(struct.new $tpair
|
|
(local.get $array1) (local.get $array2))
|
|
(local.set $pair)
|
|
|
|
(i32.const 42)
|
|
(local.set $x))
|
|
|
|
(start $f))
|
|
|