mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-22 17:29:01 +00:00
LibIDL: Support partial namespaces
This commit is contained in:
parent
b3c099bd68
commit
6e3cd7dd06
Notes:
github-actions[bot]
2025-09-11 16:08:02 +00:00
Author: https://github.com/AtkinsSJ
Commit: 6e3cd7dd06
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6071
3 changed files with 20 additions and 0 deletions
|
@ -858,6 +858,17 @@ void Parser::parse_namespace(Interface& interface)
|
||||||
consume_whitespace();
|
consume_whitespace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Parser::parse_partial_namespace(Interface& parent)
|
||||||
|
{
|
||||||
|
assert_string("partial"sv);
|
||||||
|
consume_whitespace();
|
||||||
|
assert_string("namespace"sv);
|
||||||
|
|
||||||
|
auto partial_namespace = make<Interface>();
|
||||||
|
parse_namespace(*partial_namespace);
|
||||||
|
parent.partial_namespaces.append(move(partial_namespace));
|
||||||
|
}
|
||||||
|
|
||||||
// https://webidl.spec.whatwg.org/#prod-Enum
|
// https://webidl.spec.whatwg.org/#prod-Enum
|
||||||
void Parser::parse_enumeration(HashMap<ByteString, ByteString> extended_attributes, Interface& interface)
|
void Parser::parse_enumeration(HashMap<ByteString, ByteString> extended_attributes, Interface& interface)
|
||||||
{
|
{
|
||||||
|
@ -1077,6 +1088,8 @@ void Parser::parse_non_interface_entities(bool allow_interface, Interface& inter
|
||||||
parse_partial_interface(extended_attributes, interface);
|
parse_partial_interface(extended_attributes, interface);
|
||||||
} else if (lexer.next_is("interface mixin"sv)) {
|
} else if (lexer.next_is("interface mixin"sv)) {
|
||||||
parse_interface_mixin(interface);
|
parse_interface_mixin(interface);
|
||||||
|
} else if (lexer.next_is("partial namespace"sv)) {
|
||||||
|
parse_partial_namespace(interface);
|
||||||
} else if (lexer.next_is("callback"sv)) {
|
} else if (lexer.next_is("callback"sv)) {
|
||||||
parse_callback_function(extended_attributes, interface);
|
parse_callback_function(extended_attributes, interface);
|
||||||
} else if ((allow_interface && !lexer.next_is("interface"sv) && !lexer.next_is("namespace"sv)) || !allow_interface) {
|
} else if ((allow_interface && !lexer.next_is("interface"sv) && !lexer.next_is("namespace"sv)) || !allow_interface) {
|
||||||
|
@ -1229,6 +1242,11 @@ Interface& Parser::parse()
|
||||||
interface.enumerations.set(enumeration.key, move(enumeration_copy));
|
interface.enumerations.set(enumeration.key, move(enumeration_copy));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (auto& partial_namespace : import.partial_namespaces) {
|
||||||
|
if (partial_namespace->namespace_class == interface.namespace_class)
|
||||||
|
interface.extend_with_partial_interface(*partial_namespace);
|
||||||
|
}
|
||||||
|
|
||||||
interface.typedefs.update(import.typedefs);
|
interface.typedefs.update(import.typedefs);
|
||||||
|
|
||||||
for (auto& mixin : import.mixins) {
|
for (auto& mixin : import.mixins) {
|
||||||
|
|
|
@ -47,6 +47,7 @@ private:
|
||||||
void parse_interface(Interface&);
|
void parse_interface(Interface&);
|
||||||
void parse_partial_interface(HashMap<ByteString, ByteString> extended_attributes, Interface& parent);
|
void parse_partial_interface(HashMap<ByteString, ByteString> extended_attributes, Interface& parent);
|
||||||
void parse_namespace(Interface&);
|
void parse_namespace(Interface&);
|
||||||
|
void parse_partial_namespace(Interface& parent);
|
||||||
void parse_non_interface_entities(bool allow_interface, Interface&);
|
void parse_non_interface_entities(bool allow_interface, Interface&);
|
||||||
void parse_enumeration(HashMap<ByteString, ByteString>, Interface&);
|
void parse_enumeration(HashMap<ByteString, ByteString>, Interface&);
|
||||||
void parse_typedef(Interface&);
|
void parse_typedef(Interface&);
|
||||||
|
|
|
@ -323,6 +323,7 @@ public:
|
||||||
|
|
||||||
ByteString module_own_path;
|
ByteString module_own_path;
|
||||||
Vector<NonnullOwnPtr<Interface>> partial_interfaces;
|
Vector<NonnullOwnPtr<Interface>> partial_interfaces;
|
||||||
|
Vector<NonnullOwnPtr<Interface>> partial_namespaces;
|
||||||
Vector<Interface&> imported_modules;
|
Vector<Interface&> imported_modules;
|
||||||
|
|
||||||
OrderedHashMap<ByteString, Vector<Function&>> overload_sets;
|
OrderedHashMap<ByteString, Vector<Function&>> overload_sets;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue