mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:27:43 +00:00
LibWeb: Teach IDLParser about long long
This commit is contained in:
parent
96caf3aed1
commit
3413eb1416
2 changed files with 21 additions and 0 deletions
|
@ -90,6 +90,12 @@ CppType idl_type_name_to_cpp_type(Type const& type, Interface const& interface)
|
|||
if (type.name == "unsigned short" && !type.nullable)
|
||||
return { .name = "u16", .sequence_storage_type = SequenceStorageType::Vector };
|
||||
|
||||
if (type.name == "long long" && !type.nullable)
|
||||
return { .name = "i64", .sequence_storage_type = SequenceStorageType::Vector };
|
||||
|
||||
if (type.name == "unsigned long long" && !type.nullable)
|
||||
return { .name = "u64", .sequence_storage_type = SequenceStorageType::Vector };
|
||||
|
||||
if (type.name == "long" && !type.nullable)
|
||||
return { .name = "i32", .sequence_storage_type = SequenceStorageType::Vector };
|
||||
|
||||
|
@ -1345,6 +1351,14 @@ static void generate_wrap_statement(SourceGenerator& generator, String const& va
|
|||
} else if (type.name == "unsigned long") {
|
||||
scoped_generator.append(R"~~~(
|
||||
@result_expression@ JS::Value((u32)@value@);
|
||||
)~~~");
|
||||
} else if (type.name == "long long") {
|
||||
scoped_generator.append(R"~~~(
|
||||
@result_expression@ JS::Value((double)@value@);
|
||||
)~~~");
|
||||
} else if (type.name == "unsigned long long") {
|
||||
scoped_generator.append(R"~~~(
|
||||
@result_expression@ JS::Value((double)@value@);
|
||||
)~~~");
|
||||
} else if (type.name == "Location" || type.name == "Promise" || type.name == "Uint8Array" || type.name == "Uint8ClampedArray" || type.name == "any") {
|
||||
scoped_generator.append(R"~~~(
|
||||
|
|
|
@ -181,6 +181,13 @@ NonnullRefPtr<Type> Parser::parse_type()
|
|||
consume_whitespace();
|
||||
|
||||
auto name = lexer.consume_until([](auto ch) { return !is_ascii_alphanumeric(ch) && ch != '_'; });
|
||||
|
||||
if (name.equals_ignoring_case("long"sv)) {
|
||||
consume_whitespace();
|
||||
if (lexer.consume_specific("long"sv))
|
||||
name = "long long";
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<Type> parameters;
|
||||
bool is_parameterized_type = false;
|
||||
if (lexer.consume_specific('<')) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue