Add 'crates/wiggle/' from commit 'cd484e49932d8dd8f1bd1a002e0717ad8bff07fb'
git-subtree-dir: crates/wiggle git-subtree-mainline:2ead747f48git-subtree-split:cd484e4993
This commit is contained in:
31
crates/wiggle/tests/union.witx
Normal file
31
crates/wiggle/tests/union.witx
Normal file
@@ -0,0 +1,31 @@
|
||||
(use "errno.witx")
|
||||
(use "excuse.witx")
|
||||
|
||||
;; Every worker needs a union. Organize your workplace!
|
||||
;; Fight for the full product of your labor!
|
||||
|
||||
(typename $reason
|
||||
(union $excuse
|
||||
(field $dog_ate f32)
|
||||
(field $traffic s32)
|
||||
(empty $sleeping)))
|
||||
|
||||
(typename $reason_mut
|
||||
(union $excuse
|
||||
(field $dog_ate (@witx pointer f32))
|
||||
(field $traffic (@witx pointer s32))
|
||||
(empty $sleeping)))
|
||||
|
||||
(module $union_example
|
||||
(@interface func (export "get_tag")
|
||||
(param $r $reason)
|
||||
(result $error $errno)
|
||||
(result $t $excuse)
|
||||
)
|
||||
|
||||
(@interface func (export "reason_mult")
|
||||
(param $r $reason_mut)
|
||||
(param $multiply_by u32)
|
||||
(result $error $errno)
|
||||
)
|
||||
)
|
||||
Reference in New Issue
Block a user