From 6bc6ea8e97260b0c7b78f4a24020d015431228de Mon Sep 17 00:00:00 2001 From: Srikavin Ramkumar Date: Thu, 23 Mar 2023 03:48:44 -0400 Subject: [PATCH] LibIDL: Parse extended attributes for constructors --- Userland/Libraries/LibIDL/IDLParser.cpp | 6 +++--- Userland/Libraries/LibIDL/IDLParser.h | 2 +- Userland/Libraries/LibIDL/Types.h | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Userland/Libraries/LibIDL/IDLParser.cpp b/Userland/Libraries/LibIDL/IDLParser.cpp index 240da5ff3c..22a06bd528 100644 --- a/Userland/Libraries/LibIDL/IDLParser.cpp +++ b/Userland/Libraries/LibIDL/IDLParser.cpp @@ -366,7 +366,7 @@ Function Parser::parse_function(HashMap& ext return function; } -void Parser::parse_constructor(Interface& interface) +void Parser::parse_constructor(HashMap& extended_attributes, Interface& interface) { assert_string("constructor"sv); consume_whitespace(); @@ -376,7 +376,7 @@ void Parser::parse_constructor(Interface& interface) consume_whitespace(); assert_specific(';'); - interface.constructors.append(Constructor { interface.name, move(parameters) }); + interface.constructors.append(Constructor { interface.name, move(parameters), move(extended_attributes) }); } void Parser::parse_stringifier(HashMap& extended_attributes, Interface& interface) @@ -551,7 +551,7 @@ void Parser::parse_interface(Interface& interface) } if (lexer.next_is("constructor")) { - parse_constructor(interface); + parse_constructor(extended_attributes, interface); continue; } diff --git a/Userland/Libraries/LibIDL/IDLParser.h b/Userland/Libraries/LibIDL/IDLParser.h index 2acd5fd897..32b0cf9e85 100644 --- a/Userland/Libraries/LibIDL/IDLParser.h +++ b/Userland/Libraries/LibIDL/IDLParser.h @@ -47,7 +47,7 @@ private: void parse_interface_mixin(Interface&); void parse_dictionary(Interface&); void parse_callback_function(HashMap& extended_attributes, Interface&); - void parse_constructor(Interface&); + void parse_constructor(HashMap& extended_attributes, Interface&); void parse_getter(HashMap& extended_attributes, Interface&); void parse_setter(HashMap& extended_attributes, Interface&); void parse_deleter(HashMap& extended_attributes, Interface&); diff --git a/Userland/Libraries/LibIDL/Types.h b/Userland/Libraries/LibIDL/Types.h index a471fb0aca..e76f21e30e 100644 --- a/Userland/Libraries/LibIDL/Types.h +++ b/Userland/Libraries/LibIDL/Types.h @@ -164,6 +164,7 @@ struct Function { struct Constructor { DeprecatedString name; Vector parameters; + HashMap extended_attributes; size_t shortest_length() const { return get_function_shortest_length(*this); } };