mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 01:00:05 +00:00
LibWeb/WebAssembly: Change behavior of explicit undefined
in tables
This commit is contained in:
parent
3be7e88903
commit
80434fa516
Notes:
github-actions[bot]
2024-08-18 21:36:03 +00:00
Author: https://github.com/dzfrias
Commit: 80434fa516
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1105
Reviewed-by: https://github.com/alimpfard
3 changed files with 26 additions and 10 deletions
|
@ -455,6 +455,22 @@ JS::ThrowCompletionOr<Wasm::Value> to_webassembly_value(JS::VM& vm, JS::Value va
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
Wasm::Value default_webassembly_value(JS::VM& vm, Wasm::ValueType type)
|
||||
{
|
||||
switch (type.kind()) {
|
||||
case Wasm::ValueType::I32:
|
||||
case Wasm::ValueType::I64:
|
||||
case Wasm::ValueType::F32:
|
||||
case Wasm::ValueType::F64:
|
||||
case Wasm::ValueType::V128:
|
||||
case Wasm::ValueType::FunctionReference:
|
||||
return Wasm::Value(type);
|
||||
case Wasm::ValueType::ExternReference:
|
||||
return MUST(to_webassembly_value(vm, JS::js_undefined(), type));
|
||||
}
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
// https://webassembly.github.io/spec/js-api/#tojsvalue
|
||||
JS::Value to_js_value(JS::VM& vm, Wasm::Value& wasm_value, Wasm::ValueType type)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue