1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:17:35 +00:00

LibIDL: Parse extended attributes for constructors

This commit is contained in:
Srikavin Ramkumar 2023-03-23 03:48:44 -04:00 committed by Andreas Kling
parent da671a0c16
commit 6bc6ea8e97
3 changed files with 5 additions and 4 deletions

View file

@ -366,7 +366,7 @@ Function Parser::parse_function(HashMap<DeprecatedString, DeprecatedString>& ext
return function; return function;
} }
void Parser::parse_constructor(Interface& interface) void Parser::parse_constructor(HashMap<DeprecatedString, DeprecatedString>& extended_attributes, Interface& interface)
{ {
assert_string("constructor"sv); assert_string("constructor"sv);
consume_whitespace(); consume_whitespace();
@ -376,7 +376,7 @@ void Parser::parse_constructor(Interface& interface)
consume_whitespace(); consume_whitespace();
assert_specific(';'); 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<DeprecatedString, DeprecatedString>& extended_attributes, Interface& interface) void Parser::parse_stringifier(HashMap<DeprecatedString, DeprecatedString>& extended_attributes, Interface& interface)
@ -551,7 +551,7 @@ void Parser::parse_interface(Interface& interface)
} }
if (lexer.next_is("constructor")) { if (lexer.next_is("constructor")) {
parse_constructor(interface); parse_constructor(extended_attributes, interface);
continue; continue;
} }

View file

@ -47,7 +47,7 @@ private:
void parse_interface_mixin(Interface&); void parse_interface_mixin(Interface&);
void parse_dictionary(Interface&); void parse_dictionary(Interface&);
void parse_callback_function(HashMap<DeprecatedString, DeprecatedString>& extended_attributes, Interface&); void parse_callback_function(HashMap<DeprecatedString, DeprecatedString>& extended_attributes, Interface&);
void parse_constructor(Interface&); void parse_constructor(HashMap<DeprecatedString, DeprecatedString>& extended_attributes, Interface&);
void parse_getter(HashMap<DeprecatedString, DeprecatedString>& extended_attributes, Interface&); void parse_getter(HashMap<DeprecatedString, DeprecatedString>& extended_attributes, Interface&);
void parse_setter(HashMap<DeprecatedString, DeprecatedString>& extended_attributes, Interface&); void parse_setter(HashMap<DeprecatedString, DeprecatedString>& extended_attributes, Interface&);
void parse_deleter(HashMap<DeprecatedString, DeprecatedString>& extended_attributes, Interface&); void parse_deleter(HashMap<DeprecatedString, DeprecatedString>& extended_attributes, Interface&);

View file

@ -164,6 +164,7 @@ struct Function {
struct Constructor { struct Constructor {
DeprecatedString name; DeprecatedString name;
Vector<Parameter> parameters; Vector<Parameter> parameters;
HashMap<DeprecatedString, DeprecatedString> extended_attributes;
size_t shortest_length() const { return get_function_shortest_length(*this); } size_t shortest_length() const { return get_function_shortest_length(*this); }
}; };