* Implement module imports into components As a step towards implementing function imports into a component this commit implements importing modules into a component. This fills out missing pieces of functionality such as exporting modules as well. The previous translation code had initial support for translating imported modules but some of the AST type information was restructured with feedback from this implementation, namely splitting the `InstantiateModule` initializer into separate upvar/import variants to clarify that the item orderings for imports are resolved differently at runtime. Much of this commit is also adding infrastructure for any imports at all into a component. For example a `Linker` type (analagous to `wasmtime::Linker`) was added here as well. For now this type is quite limited due to the inability to define host functions (it can only work with instances and instances-of-modules) but it's enough to start writing `*.wast` tests which exercise lots of module-related functionality. * Fix a warning
19 lines
453 B
Plaintext
19 lines
453 B
Plaintext
(assert_unlinkable
|
|
(component
|
|
(import "undefined-name" (module))
|
|
)
|
|
"import `undefined-name` not defined")
|
|
(component $i)
|
|
(component
|
|
(import "i" (instance))
|
|
)
|
|
(assert_unlinkable
|
|
(component (import "i" (module)))
|
|
"expected module found instance")
|
|
(assert_unlinkable
|
|
(component (import "i" (func)))
|
|
"expected func found instance")
|
|
(assert_unlinkable
|
|
(component (import "i" (instance (export "x" (func)))))
|
|
"export `x` not defined")
|