mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 13:19:05 +00:00
LibWeb: Add support for implementing an IDL class with a different name
Add support for the extended attribute "ImplementedAs" for IDL interfaces too. This allows a class which implements an IDL interface to have a different class name than the interface itself.
This commit is contained in:
parent
62f62a0e52
commit
1b6346ee1c
Notes:
sideshowbarker
2024-07-17 09:56:35 +09:00
Author: https://github.com/shannonbooth
Commit: 1b6346ee1c
Pull-request: https://github.com/SerenityOS/serenity/pull/23152
Reviewed-by: https://github.com/awesomekling ✅
3 changed files with 10 additions and 4 deletions
|
@ -634,8 +634,13 @@ void Parser::parse_interface(Interface& interface)
|
|||
else
|
||||
interface.namespaced_name = interface.name;
|
||||
|
||||
interface.constructor_class = ByteString::formatted("{}Constructor", interface.name);
|
||||
interface.prototype_class = ByteString::formatted("{}Prototype", interface.name);
|
||||
if (auto maybe_implemented_as = interface.extended_attributes.get("ImplementedAs"); maybe_implemented_as.has_value())
|
||||
interface.implemented_name = maybe_implemented_as.release_value();
|
||||
else
|
||||
interface.implemented_name = interface.name;
|
||||
|
||||
interface.constructor_class = ByteString::formatted("{}Constructor", interface.implemented_name);
|
||||
interface.prototype_class = ByteString::formatted("{}Prototype", interface.implemented_name);
|
||||
interface.prototype_base_class = ByteString::formatted("{}Prototype", interface.parent_name.is_empty() ? "Object" : interface.parent_name);
|
||||
interface.global_mixin_class = ByteString::formatted("{}GlobalMixin", interface.name);
|
||||
consume_whitespace();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue