Files
cli/vendor/wit-component/tests/components/tricky-resources4/component.wat

65 lines
2.4 KiB
Plaintext

(component
(core module $main (;0;)
(type (;0;) (func (param i32) (result i32)))
(type (;1;) (func (result i32)))
(import "[export]foo:bar/name" "[resource-new]name" (func $new (;0;) (type 0)))
(export "foo:bar/name#foo" (func 1))
(func (;1;) (type 1) (result i32)
i32.const 100
call $new
)
(@producers
(processed-by "wit-component" "$CARGO_PKG_VERSION")
(processed-by "my-fake-bindgen" "123.45")
)
)
(type $name (;0;) (resource (rep i32)))
(core func $resource.new (;0;) (canon resource.new $name))
(core instance $"[export]foo:bar/name" (;0;)
(export "[resource-new]name" (func $resource.new))
)
(core instance $main (;1;) (instantiate $main
(with "[export]foo:bar/name" (instance $"[export]foo:bar/name"))
)
)
(type (;1;) (own $name))
(type (;2;) (func (result 1)))
(alias core export $main "foo:bar/name#foo" (core func $foo:bar/name#foo (;1;)))
(func $foo (;0;) (type 2) (canon lift (core func $foo:bar/name#foo)))
(component $foo:bar/name-shim-component (;0;)
(import "import-type-name" (type (;0;) (sub resource)))
(import "import-type-handle" (type (;1;) (eq 0)))
(type (;2;) (own 1))
(type (;3;) (func (result 2)))
(import "import-func-foo" (func (;0;) (type 3)))
(export (;4;) "name" (type 0))
(export (;5;) "handle" (type 4))
(type (;6;) (own 5))
(type (;7;) (func (result 6)))
(export (;1;) "foo" (func 0) (func (type 7)))
)
(instance $foo:bar/name-shim-instance (;0;) (instantiate $foo:bar/name-shim-component
(with "import-func-foo" (func $foo))
(with "import-type-name" (type $name))
(with "import-type-handle" (type $name))
)
)
(export $foo:bar/name (;1;) "foo:bar/name" (instance $foo:bar/name-shim-instance))
(alias export $foo:bar/name "name" (type $"#type3 name" (@name "name") (;3;)))
(alias export $foo:bar/name "handle" (type $handle (;4;)))
(component $name-shim-component (;1;)
(import "import-type-name" (type (;0;) (sub resource)))
(import "import-type-handle" (type (;1;) (eq 0)))
(export (;2;) "handle" (type 1))
)
(instance $name-shim-instance (;2;) (instantiate $name-shim-component
(with "import-type-name" (type $"#type3 name"))
(with "import-type-handle" (type $handle))
)
)
(export $name (;3;) "name" (instance $name-shim-instance))
(@producers
(processed-by "wit-component" "$CARGO_PKG_VERSION")
)
)