mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:47:44 +00:00
BindingsGenerator+LibWeb: Pass a VM to static IDL-based functions
This saves us from having to yoink the VM out of thin air.
This commit is contained in:
parent
8a78679152
commit
0823a3c422
4 changed files with 14 additions and 11 deletions
|
@ -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@); }));
|
||||
)~~~");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue