1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:38:11 +00:00

LibWeb: Read the correct types in WebAssembly's to_js_value()

A wasm value containing an F64 does not contain a float, etc.
This commit is contained in:
Ali Mohammad Pur 2021-07-22 13:24:45 +04:30 committed by Ali Mohammad Pur
parent 13a2e91fc5
commit 03629a2b3c

View file

@ -348,12 +348,12 @@ JS::Value to_js_value(Wasm::Value& wasm_value, JS::GlobalObject& global_object)
case Wasm::ValueType::I32:
return JS::Value(wasm_value.to<i32>().value());
case Wasm::ValueType::F64:
return JS::Value(static_cast<double>(wasm_value.to<float>().value()));
case Wasm::ValueType::F32:
return JS::Value(wasm_value.to<double>().value());
case Wasm::ValueType::F32:
return JS::Value(static_cast<double>(wasm_value.to<float>().value()));
case Wasm::ValueType::FunctionReference:
// FIXME: What's the name of a function reference that isn't exported?
return create_native_function(wasm_value.to<Wasm::FunctionAddress>().value(), "FIXME_IHaveNoIdeaWhatThisShouldBeCalled", global_object);
return create_native_function(wasm_value.to<Wasm::Reference::Func>().value().address, "FIXME_IHaveNoIdeaWhatThisShouldBeCalled", global_object);
case Wasm::ValueType::NullFunctionReference:
return JS::js_null();
case Wasm::ValueType::ExternReference: