From 5952bc1ea42fceab185f775c7cb06d0c74c1e428 Mon Sep 17 00:00:00 2001 From: Luke Date: Tue, 4 May 2021 21:38:07 +0100 Subject: [PATCH] LibWeb: Add support for extended attributes on IDL parameters Also adds support for [LegacyNullToEmptyString] for parameters. --- .../LibWeb/CodeGenerators/WrapperGenerator.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp b/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp index 1bd13277a4..eb6d0672a6 100644 --- a/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp +++ b/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp @@ -90,6 +90,7 @@ struct Parameter { String name; bool optional { false }; String optional_default_value {}; + HashMap extended_attributes; }; struct Function { @@ -267,13 +268,16 @@ static OwnPtr parse_interface(StringView filename, const StringView& for (;;) { if (lexer.next_is(')')) break; + HashMap extended_attributes; + if (lexer.consume_specific('[')) + extended_attributes = parse_extended_attributes(); bool optional = lexer.consume_specific("optional"); if (optional) consume_whitespace(); auto type = parse_type(); consume_whitespace(); auto name = lexer.consume_until([](auto ch) { return isspace(ch) || ch == ',' || ch == ')' || ch == '='; }); - Parameter parameter = { move(type), move(name), optional }; + Parameter parameter = { move(type), move(name), optional, {}, extended_attributes }; consume_whitespace(); if (lexer.next_is(')')) { parameters.append(parameter); @@ -708,8 +712,8 @@ static void generate_arguments(SourceGenerator& generator, const Vector