Skip to content

Commit

Permalink
add composability for general import (#1380)
Browse files Browse the repository at this point in the history
  • Loading branch information
macovedj authored Jan 19, 2024
1 parent 2210c57 commit 8b9ba68
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 10 deletions.
10 changes: 1 addition & 9 deletions crates/wasm-compose/src/composer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,15 +407,7 @@ impl<'a> CompositionGraphBuilder<'a> {
let count = queue.len();

// Push a dependency for every instance import
'outer: for (import, name, ty) in component.imports() {
match ty {
ComponentTypeRef::Instance(_) => {}
_ => bail!(
"component `{path}` has a non-instance import named `{name}`",
path = component.path().unwrap().display()
),
}

'outer: for (import, name, _) in component.imports() {
log::debug!("adding dependency for argument `{name}` (import index {import}) from instance `{instance_name}` to the queue", import = import.0);

// Search for a matching definition export for this import
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(component
(instance)
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
(component
(type (;0;) (func))
(import "a" (func (;0;) (type 0)))
(component (;0;)
(type (;0;) (func))
(import "a" (func (;0;) (type 0)))
(type (;1;)
(instance)
)
(import "locked-dep=<foo:add@1.0.0>" (instance (;0;) (type 1)))
)
(component (;1;)
(instance (;0;))
)
(instance (;0;) (instantiate 1))
(instance (;1;) (instantiate 0
(with "locked-dep=<foo:add@1.0.0>" (instance 0))
(with "a" (func 0))
)
)
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
instantiations:
root:
arguments:
locked-dep=<foo:add@1.0.0>: a1
a1:
dependency: b

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(component
(import "a" (func))
(import "locked-dep=<foo:add@1.0.0>" (instance))
)

0 comments on commit 8b9ba68

Please sign in to comment.