mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-30 11:37:16 +02:00
LibWeb/WebAssembly: Change behavior of explicit undefined in tables
This commit is contained in:
committed by
Ali Mohammad Pur
parent
3be7e88903
commit
80434fa516
Notes:
github-actions[bot]
2024-08-18 21:36:03 +00:00
Author: https://github.com/dzfrias Commit: https://github.com/LadybirdBrowser/ladybird/commit/80434fa516f Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1105 Reviewed-by: https://github.com/alimpfard
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user