Files
cli/vendor/wit-component/tests/components/import-and-export-resource/component.wat

54 lines
2.2 KiB
Plaintext
Raw Normal View History

(component
(type $ty-foo:bar/foo (;0;)
(instance
(export (;0;) "a" (type (sub resource)))
)
)
(import "foo:bar/foo" (instance $foo:bar/foo (;0;) (type $ty-foo:bar/foo)))
(alias export $foo:bar/foo "a" (type $a (;1;)))
(import "a" (type $"#type2 a" (@name "a") (;2;) (eq $a)))
(core module $main (;0;)
(type (;0;) (func (param i32)))
(type (;1;) (func (param i32) (result i32)))
(import "foo:bar/foo" "[resource-drop]a" (func (;0;) (type 0)))
(import "[export]foo:bar/foo" "[resource-drop]a" (func (;1;) (type 0)))
(import "[export]foo:bar/foo" "[resource-rep]a" (func (;2;) (type 1)))
(import "[export]foo:bar/foo" "[resource-new]a" (func (;3;) (type 1)))
(@producers
(processed-by "wit-component" "$CARGO_PKG_VERSION")
(processed-by "my-fake-bindgen" "123.45")
)
)
(type $"#type3 a" (@name "a") (;3;) (resource (rep i32)))
(alias export $foo:bar/foo "a" (type $"#type4 a" (@name "a") (;4;)))
(core func $resource.drop (;0;) (canon resource.drop $"#type4 a"))
(core instance $foo:bar/foo (;0;)
(export "[resource-drop]a" (func $resource.drop))
)
(core func $"#core-func1 resource.drop" (@name "resource.drop") (;1;) (canon resource.drop $"#type3 a"))
(core func $resource.rep (;2;) (canon resource.rep $"#type3 a"))
(core func $resource.new (;3;) (canon resource.new $"#type3 a"))
(core instance $"[export]foo:bar/foo" (;1;)
(export "[resource-drop]a" (func $"#core-func1 resource.drop"))
(export "[resource-rep]a" (func $resource.rep))
(export "[resource-new]a" (func $resource.new))
)
(core instance $main (;2;) (instantiate $main
(with "foo:bar/foo" (instance $foo:bar/foo))
(with "[export]foo:bar/foo" (instance $"[export]foo:bar/foo"))
)
)
(component $foo:bar/foo-shim-component (;0;)
(import "import-type-a" (type (;0;) (sub resource)))
(export (;1;) "a" (type 0))
)
(instance $foo:bar/foo-shim-instance (;1;) (instantiate $foo:bar/foo-shim-component
(with "import-type-a" (type $"#type3 a"))
)
)
(export $"#instance2 foo:bar/foo" (@name "foo:bar/foo") (;2;) "foo:bar/foo" (instance $foo:bar/foo-shim-instance))
(@producers
(processed-by "wit-component" "$CARGO_PKG_VERSION")
)
)