mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:38:11 +00:00
LibWasm+LibWeb: Implement (a very basic version of) the JS link/import
This allows Wasm code to call javascript functions.
This commit is contained in:
parent
a2af04837e
commit
3926eab3b7
6 changed files with 113 additions and 39 deletions
|
@ -47,13 +47,7 @@ Result Configuration::call(FunctionAddress address, Vector<Value> arguments)
|
|||
|
||||
// It better be a host function, else something is really wrong.
|
||||
auto& host_function = function->get<HostFunction>();
|
||||
auto result = bit_cast<HostFunctionType>(host_function.ptr())(m_store, arguments);
|
||||
auto count = host_function.type().results().size();
|
||||
if (count == 0)
|
||||
return Result { Vector<Value> {} };
|
||||
if (count == 1)
|
||||
return Result { Vector<Value> { Value { host_function.type().results().first(), result } } };
|
||||
TODO();
|
||||
return host_function.function()(*this, arguments);
|
||||
}
|
||||
|
||||
Result Configuration::execute()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue