1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:37:44 +00:00

CodeGenerators: Ensure that we always print the entire generated output

This commit is contained in:
Tim Schumacher 2023-03-01 16:28:32 +01:00 committed by Linus Groh
parent e007279315
commit 8032724574
17 changed files with 37 additions and 74 deletions

View file

@ -160,8 +160,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (global_mixin_implementation_mode)
IDL::generate_global_mixin_implementation(interface, output_builder);
// FIXME: This should write the entire span.
TRY(output_file->write_some(output_builder.string_view().bytes()));
TRY(output_file->write_until_depleted(output_builder.string_view().bytes()));
if (!depfile_path.is_null()) {
auto depfile = TRY(Core::File::open_file_or_standard_stream(depfile_path, Core::File::OpenMode::Write));
@ -174,8 +173,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
depfile_builder.append(path);
}
depfile_builder.append('\n');
// FIXME: This should write the entire span.
TRY(depfile->write_some(depfile_builder.string_view().bytes()));
TRY(depfile->write_until_depleted(depfile_builder.string_view().bytes()));
}
return 0;
}

View file

@ -95,8 +95,7 @@ enum class ValueID;
generator.appendln("}");
// FIXME: This should write the entire span.
TRY(file.write_some(generator.as_string_view().bytes()));
TRY(file.write_until_depleted(generator.as_string_view().bytes()));
return {};
}
@ -200,7 +199,6 @@ StringView to_string(@name:titlecase@ value)
generator.appendln("}");
// FIXME: This should write the entire span.
TRY(file.write_some(generator.as_string_view().bytes()));
TRY(file.write_until_depleted(generator.as_string_view().bytes()));
return {};
}

View file

@ -80,8 +80,7 @@ bool media_feature_accepts_identifier(MediaFeatureID, ValueID);
}
)~~~");
// FIXME: This should write the entire span.
TRY(file.write_some(generator.as_string_view().bytes()));
TRY(file.write_until_depleted(generator.as_string_view().bytes()));
return {};
}
@ -291,7 +290,6 @@ bool media_feature_accepts_identifier(MediaFeatureID media_feature_id, ValueID i
}
)~~~");
// FIXME: This should write the entire span.
TRY(file.write_some(generator.as_string_view().bytes()));
TRY(file.write_until_depleted(generator.as_string_view().bytes()));
return {};
}

View file

@ -140,8 +140,7 @@ struct Traits<Web::CSS::PropertyID> : public GenericTraits<Web::CSS::PropertyID>
} // namespace AK
)~~~");
// FIXME: This should write the entire span.
TRY(file.write_some(generator.as_string_view().bytes()));
TRY(file.write_until_depleted(generator.as_string_view().bytes()));
return {};
}
@ -606,7 +605,6 @@ size_t property_maximum_value_count(PropertyID property_id)
)~~~");
// FIXME: This should write the entire span.
TRY(file.write_some(generator.as_string_view().bytes()));
TRY(file.write_until_depleted(generator.as_string_view().bytes()));
return {};
}

View file

@ -96,8 +96,7 @@ TransformFunctionMetadata transform_function_metadata(TransformFunction);
generator.appendln("\n}");
// FIXME: This should write the entire span.
TRY(file.write_some(generator.as_string_view().bytes()));
TRY(file.write_until_depleted(generator.as_string_view().bytes()));
return {};
}
@ -206,7 +205,6 @@ TransformFunctionMetadata transform_function_metadata(TransformFunction transfor
generator.appendln("\n}");
// FIXME: This should write the entire span.
TRY(file.write_some(generator.as_string_view().bytes()));
TRY(file.write_until_depleted(generator.as_string_view().bytes()));
return {};
}

View file

@ -74,8 +74,7 @@ StringView string_from_value_id(ValueID);
)~~~");
// FIXME: This should write the entire span.
TRY(file.write_some(generator.as_string_view().bytes()));
TRY(file.write_until_depleted(generator.as_string_view().bytes()));
return {};
}
@ -135,7 +134,6 @@ StringView string_from_value_id(ValueID value_id) {
} // namespace Web::CSS
)~~~");
// FIXME: This should write the entire span.
TRY(file.write_some(generator.as_string_view().bytes()));
TRY(file.write_until_depleted(generator.as_string_view().bytes()));
return {};
}

View file

@ -105,8 +105,7 @@ class @legacy_constructor_class@;)~~~");
auto generated_forward_path = LexicalPath(output_path).append("Forward.h"sv).string();
auto generated_forward_file = TRY(Core::File::open(generated_forward_path, Core::File::OpenMode::Write));
// FIXME: This should write the entire span.
TRY(generated_forward_file->write_some(generator.as_string_view().bytes()));
TRY(generated_forward_file->write_until_depleted(generator.as_string_view().bytes()));
return {};
}
@ -209,8 +208,7 @@ void Intrinsics::create_web_prototype_and_constructor<@prototype_class@>(JS::Rea
auto generated_intrinsics_path = LexicalPath(output_path).append("IntrinsicDefinitions.cpp"sv).string();
auto generated_intrinsics_file = TRY(Core::File::open(generated_intrinsics_path, Core::File::OpenMode::Write));
// FIXME: This should write the entire span.
TRY(generated_intrinsics_file->write_some(generator.as_string_view().bytes()));
TRY(generated_intrinsics_file->write_until_depleted(generator.as_string_view().bytes()));
return {};
}
@ -236,8 +234,7 @@ void add_@global_object_snake_name@_exposed_interfaces(JS::Object&);
auto generated_header_path = LexicalPath(output_path).append(DeprecatedString::formatted("{}ExposedInterfaces.h", class_name)).string();
auto generated_header_file = TRY(Core::File::open(generated_header_path, Core::File::OpenMode::Write));
// FIXME: This should write the entire span.
TRY(generated_header_file->write_some(generator.as_string_view().bytes()));
TRY(generated_header_file->write_until_depleted(generator.as_string_view().bytes()));
return {};
}
@ -306,8 +303,7 @@ void add_@global_object_snake_name@_exposed_interfaces(JS::Object& global)
auto generated_implementation_path = LexicalPath(output_path).append(DeprecatedString::formatted("{}ExposedInterfaces.cpp", class_name)).string();
auto generated_implementation_file = TRY(Core::File::open(generated_implementation_path, Core::File::OpenMode::Write));
// FIXME: This should write the entire span.
TRY(generated_implementation_file->write_some(generator.as_string_view().bytes()));
TRY(generated_implementation_file->write_until_depleted(generator.as_string_view().bytes()));
return {};
}