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

LibWeb: Support NoInstanceWrapper extended attribute on interfaces

This tells the wrapper generator that there is no separate wrapper class
for this interface, and it should refer directly to the C++ "Foo" object
instead of "FooWrapper".
This commit is contained in:
Andreas Kling 2022-08-06 14:53:39 +02:00
parent b33b426b2e
commit 4ae2390554
2 changed files with 13 additions and 1 deletions

View file

@ -570,7 +570,11 @@ void Parser::parse_interface(Interface& interface)
parse_function(extended_attributes, interface);
}
interface.wrapper_class = String::formatted("{}Wrapper", interface.name);
if (interface.extended_attributes.contains("NoInstanceWrapper")) {
interface.wrapper_class = interface.name;
} else {
interface.wrapper_class = String::formatted("{}Wrapper", interface.name);
}
interface.wrapper_base_class = String::formatted("{}Wrapper", interface.parent_name.is_empty() ? String::empty() : interface.parent_name);
interface.constructor_class = String::formatted("{}Constructor", interface.name);
interface.prototype_class = String::formatted("{}Prototype", interface.name);