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:
parent
b33b426b2e
commit
4ae2390554
Notes:
sideshowbarker
2024-07-17 07:29:23 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/4ae2390554 Pull-request: https://github.com/SerenityOS/serenity/pull/14816 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/linusg ✅
2 changed files with 13 additions and 1 deletions
|
@ -1979,7 +1979,9 @@ void generate_implementation(IDL::Interface const& interface)
|
|||
#include <LibJS/Runtime/TypedArray.h>
|
||||
#include <LibJS/Runtime/Value.h>
|
||||
#include <LibWeb/Bindings/@prototype_class@.h>
|
||||
#if __has_include(<LibWeb/Bindings/@wrapper_class@.h>)
|
||||
#include <LibWeb/Bindings/@wrapper_class@.h>
|
||||
#endif
|
||||
#include <LibWeb/Bindings/ExceptionOrUtils.h>
|
||||
#include <LibWeb/Bindings/NodeWrapper.h>
|
||||
#include <LibWeb/Bindings/WindowObject.h>
|
||||
|
@ -2858,7 +2860,9 @@ void generate_constructor_implementation(IDL::Interface const& interface)
|
|||
#include <LibJS/Runtime/ArrayBuffer.h>
|
||||
#include <LibWeb/Bindings/@constructor_class@.h>
|
||||
#include <LibWeb/Bindings/@prototype_class@.h>
|
||||
#if __has_include(<LibWeb/Bindings/@wrapper_class@.h>)
|
||||
#include <LibWeb/Bindings/@wrapper_class@.h>
|
||||
#endif
|
||||
#include <LibWeb/Bindings/CSSRuleWrapperFactory.h>
|
||||
#include <LibWeb/Bindings/EventTargetWrapperFactory.h>
|
||||
#include <LibWeb/Bindings/EventWrapperFactory.h>
|
||||
|
@ -3162,7 +3166,9 @@ void generate_prototype_implementation(IDL::Interface const& interface)
|
|||
#include <LibJS/Runtime/TypedArray.h>
|
||||
#include <LibJS/Runtime/Value.h>
|
||||
#include <LibWeb/Bindings/@prototype_class@.h>
|
||||
#if __has_include(<LibWeb/Bindings/@wrapper_class@.h>)
|
||||
#include <LibWeb/Bindings/@wrapper_class@.h>
|
||||
#endif
|
||||
#include <LibWeb/Bindings/EventWrapper.h>
|
||||
#include <LibWeb/Bindings/EventWrapperFactory.h>
|
||||
#include <LibWeb/Bindings/ExceptionOrUtils.h>
|
||||
|
@ -3640,7 +3646,9 @@ void generate_iterator_implementation(IDL::Interface const& interface)
|
|||
#include <LibJS/Runtime/TypedArray.h>
|
||||
#include <LibJS/Runtime/Value.h>
|
||||
#include <LibWeb/Bindings/@prototype_class@.h>
|
||||
#if __has_include(<LibWeb/Bindings/@wrapper_class@.h>)
|
||||
#include <LibWeb/Bindings/@wrapper_class@.h>
|
||||
#endif
|
||||
#include <LibWeb/Bindings/IDLAbstractOperations.h>
|
||||
#include <LibWeb/Bindings/WindowObject.h>
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue