mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:17:35 +00:00
Everywhere: Run clang-format
This commit is contained in:
parent
0376c127f6
commit
086969277e
1665 changed files with 8479 additions and 8479 deletions
|
@ -33,7 +33,7 @@ void WebAssemblyInstanceObject::initialize(JS::GlobalObject& global_object)
|
|||
auto& cache = this->cache();
|
||||
for (auto& export_ : instance.exports()) {
|
||||
export_.value().visit(
|
||||
[&](const Wasm::FunctionAddress& address) {
|
||||
[&](Wasm::FunctionAddress const& address) {
|
||||
auto object = cache.function_instances.get(address);
|
||||
if (!object.has_value()) {
|
||||
object = create_native_function(global_object, address, export_.name());
|
||||
|
@ -41,7 +41,7 @@ void WebAssemblyInstanceObject::initialize(JS::GlobalObject& global_object)
|
|||
}
|
||||
m_exports_object->define_direct_property(export_.name(), *object, JS::default_attributes);
|
||||
},
|
||||
[&](const Wasm::MemoryAddress& address) {
|
||||
[&](Wasm::MemoryAddress const& address) {
|
||||
auto object = cache.memory_instances.get(address);
|
||||
if (!object.has_value()) {
|
||||
object = heap().allocate<Web::Bindings::WebAssemblyMemoryObject>(global_object, global_object, address);
|
||||
|
@ -49,7 +49,7 @@ void WebAssemblyInstanceObject::initialize(JS::GlobalObject& global_object)
|
|||
}
|
||||
m_exports_object->define_direct_property(export_.name(), *object, JS::default_attributes);
|
||||
},
|
||||
[&](const auto&) {
|
||||
[&](auto const&) {
|
||||
// FIXME: Implement other exports!
|
||||
});
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
virtual ~WebAssemblyModuleObject() override = default;
|
||||
|
||||
size_t index() const { return m_index; }
|
||||
const Wasm::Module& module() const { return WebAssemblyObject::s_compiled_modules.at(m_index).module; }
|
||||
Wasm::Module const& module() const { return WebAssemblyObject::s_compiled_modules.at(m_index).module; }
|
||||
|
||||
private:
|
||||
size_t m_index { 0 };
|
||||
|
|
|
@ -184,7 +184,7 @@ JS::ThrowCompletionOr<size_t> WebAssemblyObject::instantiate_module(Wasm::Module
|
|||
if (!import_argument.is_undefined()) {
|
||||
auto* import_object = TRY(import_argument.to_object(global_object));
|
||||
dbgln("Trying to resolve stuff because import object was specified");
|
||||
for (const Wasm::Linker::Name& import_name : linker.unresolved_imports()) {
|
||||
for (Wasm::Linker::Name const& import_name : linker.unresolved_imports()) {
|
||||
dbgln("Trying to resolve {}::{}", import_name.module, import_name.name);
|
||||
auto value_or_error = import_object->get(import_name.module);
|
||||
if (value_or_error.is_error())
|
||||
|
@ -286,7 +286,7 @@ JS::ThrowCompletionOr<size_t> WebAssemblyObject::instantiate_module(Wasm::Module
|
|||
resolved_imports.set(import_name, Wasm::ExternValue { address });
|
||||
return {};
|
||||
},
|
||||
[&](const auto&) -> JS::ThrowCompletionOr<void> {
|
||||
[&](auto const&) -> JS::ThrowCompletionOr<void> {
|
||||
// FIXME: Implement these.
|
||||
dbgln("Unimplemented import of non-function attempted");
|
||||
return vm.throw_completion<JS::TypeError>(global_object, "LinkError: Not Implemented");
|
||||
|
@ -328,7 +328,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyObject::instantiate)
|
|||
}
|
||||
auto* buffer = buffer_or_error.release_value();
|
||||
|
||||
const Wasm::Module* module { nullptr };
|
||||
Wasm::Module const* module { nullptr };
|
||||
if (is<JS::ArrayBuffer>(buffer) || is<JS::TypedArrayBase>(buffer)) {
|
||||
auto result = parse_module(global_object, buffer);
|
||||
if (result.is_error()) {
|
||||
|
@ -386,7 +386,7 @@ JS::Value to_js_value(JS::GlobalObject& global_object, Wasm::Value& wasm_value)
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
JS::ThrowCompletionOr<Wasm::Value> to_webassembly_value(JS::GlobalObject& global_object, JS::Value value, const Wasm::ValueType& type)
|
||||
JS::ThrowCompletionOr<Wasm::Value> to_webassembly_value(JS::GlobalObject& global_object, JS::Value value, Wasm::ValueType const& type)
|
||||
{
|
||||
static ::Crypto::SignedBigInteger two_64 = "1"_sbigint.shift_left(64);
|
||||
auto& vm = global_object.vm();
|
||||
|
@ -439,7 +439,7 @@ JS::ThrowCompletionOr<Wasm::Value> to_webassembly_value(JS::GlobalObject& global
|
|||
JS::NativeFunction* create_native_function(JS::GlobalObject& global_object, Wasm::FunctionAddress address, String const& name)
|
||||
{
|
||||
Optional<Wasm::FunctionType> type;
|
||||
WebAssemblyObject::s_abstract_machine.store().get(address)->visit([&](const auto& value) { type = value.type(); });
|
||||
WebAssemblyObject::s_abstract_machine.store().get(address)->visit([&](auto const& value) { type = value.type(); });
|
||||
if (auto entry = WebAssemblyObject::s_global_cache.function_instances.get(address); entry.has_value())
|
||||
return *entry;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ class WebAssemblyMemoryObject;
|
|||
JS::ThrowCompletionOr<size_t> parse_module(JS::GlobalObject& global_object, JS::Object* buffer);
|
||||
JS::NativeFunction* create_native_function(JS::GlobalObject& global_object, Wasm::FunctionAddress address, String const& name);
|
||||
JS::Value to_js_value(JS::GlobalObject& global_object, Wasm::Value& wasm_value);
|
||||
JS::ThrowCompletionOr<Wasm::Value> to_webassembly_value(JS::GlobalObject& global_object, JS::Value value, const Wasm::ValueType& type);
|
||||
JS::ThrowCompletionOr<Wasm::Value> to_webassembly_value(JS::GlobalObject& global_object, JS::Value value, Wasm::ValueType const& type);
|
||||
|
||||
class WebAssemblyObject final : public JS::Object {
|
||||
JS_OBJECT(WebAssemblyObject, JS::Object);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue