diff --git a/Libraries/LibIDL/IDLParser.cpp b/Libraries/LibIDL/IDLParser.cpp index 3d6ddb087d8..544b36eac6d 100644 --- a/Libraries/LibIDL/IDLParser.cpp +++ b/Libraries/LibIDL/IDLParser.cpp @@ -813,13 +813,14 @@ void Parser::parse_interface(Interface& interface) consume_whitespace(); } -void Parser::parse_partial_interface(Interface& parent) +void Parser::parse_partial_interface(HashMap extended_attributes, Interface& parent) { assert_string("partial"sv); consume_whitespace(); assert_string("interface"sv); auto partial_interface = make(); + partial_interface->extended_attributes = move(extended_attributes); parse_interface(*partial_interface); parent.partial_interfaces.append(move(partial_interface)); } @@ -1063,7 +1064,7 @@ void Parser::parse_non_interface_entities(bool allow_interface, Interface& inter } else if (lexer.next_is("typedef")) { parse_typedef(interface); } else if (lexer.next_is("partial interface"sv)) { - parse_partial_interface(interface); + parse_partial_interface(extended_attributes, interface); } else if (lexer.next_is("interface mixin")) { parse_interface_mixin(interface); } else if (lexer.next_is("callback")) { diff --git a/Libraries/LibIDL/IDLParser.h b/Libraries/LibIDL/IDLParser.h index 3b2a6e818e7..16ae1998da6 100644 --- a/Libraries/LibIDL/IDLParser.h +++ b/Libraries/LibIDL/IDLParser.h @@ -45,7 +45,7 @@ private: HashMap parse_extended_attributes(); void parse_attribute(HashMap& extended_attributes, Interface&, IsStatic is_static = IsStatic::No); void parse_interface(Interface&); - void parse_partial_interface(Interface& parent); + void parse_partial_interface(HashMap extended_attributes, Interface& parent); void parse_namespace(Interface&); void parse_non_interface_entities(bool allow_interface, Interface&); void parse_enumeration(HashMap, Interface&); diff --git a/Libraries/LibIDL/Types.cpp b/Libraries/LibIDL/Types.cpp index aaaf21e86de..56b168d1fe9 100644 --- a/Libraries/LibIDL/Types.cpp +++ b/Libraries/LibIDL/Types.cpp @@ -307,11 +307,39 @@ void EffectiveOverloadSet::remove_all_other_entries() void Interface::extend_with_partial_interface(Interface const& partial) { - attributes.extend(partial.attributes); - static_attributes.extend(partial.static_attributes); + for (auto const& attribute : partial.attributes) { + auto attribute_copy = attribute; + for (auto const& [key, value] : partial.extended_attributes) { + attribute_copy.extended_attributes.set(key, value); + } + attributes.append(move(attribute_copy)); + } + + for (auto const& static_attribute : partial.static_attributes) { + auto static_attribute_copy = static_attribute; + for (auto const& [key, value] : partial.extended_attributes) { + static_attribute_copy.extended_attributes.set(key, value); + } + static_attributes.append(move(static_attribute_copy)); + } + constants.extend(partial.constants); - functions.extend(partial.functions); - static_functions.extend(partial.static_functions); + + for (auto const& function : partial.functions) { + auto function_copy = function; + for (auto const& [key, value] : partial.extended_attributes) { + function_copy.extended_attributes.set(key, value); + } + functions.append(move(function_copy)); + } + + for (auto const& static_function : partial.static_functions) { + auto static_function_copy = static_function; + for (auto const& [key, value] : partial.extended_attributes) { + static_function_copy.extended_attributes.set(key, value); + } + static_functions.append(move(static_function_copy)); + } } }