mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 03:55:24 +00:00
LibWeb: Add IDLGenerators::is_primitive()
This adds the is_primitive() method as described in the Web IDL specification. is_primitive() returns true if the type is a bigint, boolean or numeric type.
This commit is contained in:
parent
9b9b05eabf
commit
ba23d036bd
Notes:
sideshowbarker
2024-07-17 18:46:57 +09:00
Author: https://github.com/kennethmyhra Commit: https://github.com/SerenityOS/serenity/commit/ba23d036bd Pull-request: https://github.com/SerenityOS/serenity/pull/13476 Reviewed-by: https://github.com/Lubrsi Reviewed-by: https://github.com/stelar7
2 changed files with 4 additions and 1 deletions
|
@ -1475,7 +1475,7 @@ static Optional<String> generate_arguments_match_check_for_count(Vector<IDL::Par
|
|||
Vector<String> conditions;
|
||||
for (auto i = 0u; i < argument_count; ++i) {
|
||||
auto const& parameter = parameters[i];
|
||||
if (parameter.type->is_string() || parameter.type->is_numeric())
|
||||
if (parameter.type->is_string() || parameter.type->is_primitive())
|
||||
continue;
|
||||
auto argument = String::formatted("arg{}", i);
|
||||
StringBuilder condition;
|
||||
|
|
|
@ -61,6 +61,9 @@ struct Type : public RefCounted<Type> {
|
|||
|
||||
// https://webidl.spec.whatwg.org/#dfn-numeric-type
|
||||
bool is_numeric() const { return is_integer() || name.is_one_of("float", "unrestricted float", "double", "unrestricted double"); }
|
||||
|
||||
// https://webidl.spec.whatwg.org/#dfn-primitive-type
|
||||
bool is_primitive() const { return is_numeric() || name.is_one_of("bigint", "boolean"); }
|
||||
};
|
||||
|
||||
struct Parameter {
|
||||
|
|
Loading…
Add table
Reference in a new issue