From 9ff79c9d54dba1591968df6e39f57c8e8dc73fce Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Wed, 30 Mar 2022 23:34:12 +0300 Subject: [PATCH] LibWeb: Support non-interface top-level extended attributes --- .../CodeGenerators/LibWeb/WrapperGenerator/IDLParser.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLParser.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLParser.cpp index 9fff31645a..08a391dfaf 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLParser.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLParser.cpp @@ -725,6 +725,9 @@ void Parser::parse_interface_mixin(Interface& interface) void Parser::parse_non_interface_entities(bool allow_interface, Interface& interface) { while (!lexer.is_eof()) { + HashMap extended_attributes; + if (lexer.consume_specific('[')) + extended_attributes = parse_extended_attributes(); if (lexer.next_is("dictionary")) { parse_dictionary(interface); } else if (lexer.next_is("enum")) { @@ -748,6 +751,7 @@ void Parser::parse_non_interface_entities(bool allow_interface, Interface& inter report_parsing_error("expected 'enum' or 'dictionary'", filename, input, current_offset); } } else { + interface.extended_attributes = move(extended_attributes); break; } } @@ -811,9 +815,6 @@ NonnullOwnPtr Parser::parse() interface->all_imported_paths = s_all_imported_paths; interface->required_imported_paths = required_imported_paths; - if (lexer.consume_specific('[')) - interface->extended_attributes = parse_extended_attributes(); - parse_non_interface_entities(true, *interface); if (lexer.consume_specific("interface"))