summaryrefslogtreecommitdiff
path: root/Meta/Lagom
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2022-10-05 17:09:26 +0100
committerLinus Groh <mail@linusgroh.de>2022-10-06 21:45:07 +0100
commit0823a3c4227ed0b08c9c53b28599d27fec6c63bf (patch)
treeb7812619866ebf047970dc53de5b43f50177c909 /Meta/Lagom
parent8a78679152449c7b99766d030d4c89e8371088cc (diff)
downloadserenity-0823a3c4227ed0b08c9c53b28599d27fec6c63bf.zip
BindingsGenerator+LibWeb: Pass a VM to static IDL-based functions
This saves us from having to yoink the VM out of thin air.
Diffstat (limited to 'Meta/Lagom')
-rw-r--r--Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp
index bd4a0df2e1..45259bb18d 100644
--- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp
+++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp
@@ -1668,6 +1668,12 @@ JS_DEFINE_NATIVE_FUNCTION(@class_name@::@function.name:snakecase@@overload_suffi
[[maybe_unused]] auto retval = TRY(throw_dom_exception_if_needed(vm, [&] { return impl->@function.cpp_name@(@.arguments@); }));
)~~~");
} else {
+ // Make sure first argument for static functions is the Realm.
+ if (arguments_builder.is_empty())
+ function_generator.set(".arguments", "vm");
+ else
+ function_generator.set(".arguments", String::formatted("vm, {}", arguments_builder.string_view()));
+
function_generator.append(R"~~~(
[[maybe_unused]] auto retval = TRY(throw_dom_exception_if_needed(vm, [&] { return @interface_fully_qualified_name@::@function.cpp_name@(@.arguments@); }));
)~~~");