mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 15:45:25 +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:
committed by
Ali Mohammad Pur
parent
a2af04837e
commit
3926eab3b7
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user