1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:58:12 +00:00

LibIDL+WrapperGenerator: Make it easier to work with IDL::Type classes

Track the kind of Type it is, and use that to provide some convenient
`is_foo()` / `as_foo()` methods. While I was at it, made these all
classes instead of structs and made their data private.
This commit is contained in:
Sam Atkins 2022-08-24 17:22:09 +01:00 committed by Andreas Kling
parent c4668053d1
commit 7c8ef79898
6 changed files with 288 additions and 217 deletions

View file

@ -112,21 +112,21 @@ int main(int argc, char** argv)
for (auto& attribute : interface.attributes) {
dbgln(" {}{}{} {}",
attribute.readonly ? "readonly " : "",
attribute.type->name,
attribute.type->nullable ? "?" : "",
attribute.type->name(),
attribute.type->is_nullable() ? "?" : "",
attribute.name);
}
dbgln("Functions:");
for (auto& function : interface.functions) {
dbgln(" {}{} {}",
function.return_type->name,
function.return_type->nullable ? "?" : "",
function.return_type->name(),
function.return_type->is_nullable() ? "?" : "",
function.name);
for (auto& parameter : function.parameters) {
dbgln(" {}{} {}",
parameter.type->name,
parameter.type->nullable ? "?" : "",
parameter.type->name(),
parameter.type->is_nullable() ? "?" : "",
parameter.name);
}
}
@ -134,13 +134,13 @@ int main(int argc, char** argv)
dbgln("Static Functions:");
for (auto& function : interface.static_functions) {
dbgln(" static {}{} {}",
function.return_type->name,
function.return_type->nullable ? "?" : "",
function.return_type->name(),
function.return_type->is_nullable() ? "?" : "",
function.name);
for (auto& parameter : function.parameters) {
dbgln(" {}{} {}",
parameter.type->name,
parameter.type->nullable ? "?" : "",
parameter.type->name(),
parameter.type->is_nullable() ? "?" : "",
parameter.name);
}
}