mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +00:00
CodeGenerators: Ensure that we always print the entire generated output
This commit is contained in:
parent
e007279315
commit
8032724574
Notes:
sideshowbarker
2024-07-17 10:54:57 +09:00
Author: https://github.com/timschumi Commit: https://github.com/SerenityOS/serenity/commit/8032724574 Pull-request: https://github.com/SerenityOS/serenity/pull/17684 Reviewed-by: https://github.com/JanDeVisser ✅ Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/linusg ✅
17 changed files with 37 additions and 74 deletions
|
@ -211,8 +211,7 @@ namespace PnpIDs {
|
|||
}
|
||||
)~~~");
|
||||
|
||||
// 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 {};
|
||||
}
|
||||
|
||||
|
@ -266,8 +265,7 @@ IterationDecision for_each(Function<IterationDecision(PnpIDData const&)> callbac
|
|||
}
|
||||
)~~~");
|
||||
|
||||
// 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 {};
|
||||
}
|
||||
|
||||
|
|
|
@ -405,8 +405,7 @@ ErrorOr<void> generate_header_file(JsonObject& api_data, Core::File& file)
|
|||
generator.appendln("}");
|
||||
generator.appendln("#endif");
|
||||
|
||||
// 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 {};
|
||||
}
|
||||
|
||||
|
@ -530,8 +529,7 @@ ErrorOr<void> generate_implementation_file(JsonObject& api_data, Core::File& fil
|
|||
}
|
||||
});
|
||||
|
||||
// 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 {};
|
||||
}
|
||||
|
||||
|
|
|
@ -1724,8 +1724,7 @@ namespace Locale {
|
|||
}
|
||||
)~~~");
|
||||
|
||||
// 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 {};
|
||||
}
|
||||
|
||||
|
@ -2398,8 +2397,7 @@ Optional<StringView> get_time_zone_name(StringView locale, StringView time_zone,
|
|||
}
|
||||
)~~~");
|
||||
|
||||
// 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 {};
|
||||
}
|
||||
|
||||
|
|
|
@ -1047,8 +1047,7 @@ namespace Locale {
|
|||
}
|
||||
)~~~");
|
||||
|
||||
// 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 {};
|
||||
}
|
||||
|
||||
|
@ -1748,8 +1747,7 @@ ErrorOr<Optional<String>> resolve_most_likely_territory(LanguageID const& langua
|
|||
}
|
||||
)~~~");
|
||||
|
||||
// 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 {};
|
||||
}
|
||||
|
||||
|
|
|
@ -763,8 +763,7 @@ namespace Locale {
|
|||
}
|
||||
)~~~");
|
||||
|
||||
// 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 {};
|
||||
}
|
||||
|
||||
|
@ -1108,8 +1107,7 @@ ErrorOr<Vector<NumberFormat>> get_unit_formats(StringView locale, StringView uni
|
|||
}
|
||||
)~~~");
|
||||
|
||||
// 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 {};
|
||||
}
|
||||
|
||||
|
|
|
@ -442,8 +442,7 @@ namespace Locale {
|
|||
}
|
||||
)~~~");
|
||||
|
||||
// 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 {};
|
||||
}
|
||||
|
||||
|
@ -655,8 +654,7 @@ PluralCategory determine_plural_range(StringView locale, PluralCategory start, P
|
|||
}
|
||||
)~~~");
|
||||
|
||||
// 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 {};
|
||||
}
|
||||
|
||||
|
|
|
@ -180,8 +180,7 @@ namespace Locale {
|
|||
}
|
||||
)~~~");
|
||||
|
||||
// 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 {};
|
||||
}
|
||||
|
||||
|
@ -277,8 +276,7 @@ ErrorOr<Vector<RelativeTimeFormat>> get_relative_time_format_patterns(StringView
|
|||
}
|
||||
)~~~");
|
||||
|
||||
// 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 {};
|
||||
}
|
||||
|
||||
|
|
|
@ -469,8 +469,7 @@ namespace TimeZone {
|
|||
}
|
||||
)~~~");
|
||||
|
||||
// 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 {};
|
||||
}
|
||||
|
||||
|
@ -802,8 +801,7 @@ Vector<StringView> time_zones_in_region(StringView region)
|
|||
}
|
||||
)~~~");
|
||||
|
||||
// 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 {};
|
||||
}
|
||||
|
||||
|
|
|
@ -213,8 +213,7 @@ static ErrorOr<void> generate_emoji_data_header(Core::BufferedFile& file, EmojiD
|
|||
StringBuilder builder;
|
||||
SourceGenerator generator { builder };
|
||||
|
||||
// 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 {};
|
||||
}
|
||||
|
||||
|
@ -335,8 +334,7 @@ Optional<Emoji> find_emoji_for_code_points(ReadonlySpan<u32> code_points)
|
|||
}
|
||||
)~~~");
|
||||
|
||||
// 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 {};
|
||||
}
|
||||
|
||||
|
@ -381,8 +379,7 @@ static ErrorOr<void> generate_emoji_installation(Core::BufferedFile& file, Emoji
|
|||
generator.append(" @name@ (@status@)\n"sv);
|
||||
}
|
||||
|
||||
// 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 {};
|
||||
}
|
||||
|
||||
|
|
|
@ -866,8 +866,7 @@ ReadonlySpan<CaseFolding const*> case_folding_mapping(u32 code_point);
|
|||
}
|
||||
)~~~");
|
||||
|
||||
// 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 {};
|
||||
}
|
||||
|
||||
|
@ -1355,8 +1354,7 @@ bool code_point_has_@enum_snake@(u32 code_point, @enum_title@ @enum_snake@)
|
|||
}
|
||||
)~~~");
|
||||
|
||||
// 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 {};
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 {};
|
||||
}
|
||||
|
|
|
@ -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 {};
|
||||
}
|
||||
|
|
|
@ -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 {};
|
||||
}
|
||||
|
|
|
@ -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 {};
|
||||
}
|
||||
|
|
|
@ -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 {};
|
||||
}
|
||||
|
|
|
@ -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 {};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue