mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-23 13:05:12 +00:00
Libraries: Use AK::Variant default initialization where appropriate
This commit is contained in:
parent
98a0f9c0bd
commit
32e98d0924
Notes:
sideshowbarker
2024-07-18 03:35:49 +09:00
Author: https://github.com/BenWiederhake Commit: https://github.com/SerenityOS/serenity/commit/32e98d09241 Pull-request: https://github.com/SerenityOS/serenity/pull/10154 Reviewed-by: https://github.com/alimpfard
8 changed files with 12 additions and 12 deletions
|
@ -74,7 +74,7 @@ struct MultiHashDigestVariant {
|
|||
}
|
||||
|
||||
using DigestVariant = Variant<Empty, MD5::DigestType, SHA1::DigestType, SHA256::DigestType, SHA384::DigestType, SHA512::DigestType>;
|
||||
DigestVariant m_digest { Empty {} };
|
||||
DigestVariant m_digest {};
|
||||
};
|
||||
|
||||
class Manager final : public HashFunction<0, MultiHashDigestVariant> {
|
||||
|
@ -198,7 +198,7 @@ public:
|
|||
|
||||
private:
|
||||
using AlgorithmVariant = Variant<Empty, MD5, SHA1, SHA256, SHA384, SHA512>;
|
||||
AlgorithmVariant m_algorithm { Empty {} };
|
||||
AlgorithmVariant m_algorithm {};
|
||||
HashKind m_kind { HashKind::None };
|
||||
ByteBuffer m_pre_init_buffer;
|
||||
};
|
||||
|
|
|
@ -317,8 +317,8 @@ struct BindingPattern : RefCounted<BindingPattern> {
|
|||
// This covers both BindingProperty and BindingElement, hence the more generic name
|
||||
struct BindingEntry {
|
||||
// If this entry represents a BindingElement, then name will be Empty
|
||||
Variant<NonnullRefPtr<Identifier>, NonnullRefPtr<Expression>, Empty> name { Empty {} };
|
||||
Variant<NonnullRefPtr<Identifier>, NonnullRefPtr<BindingPattern>, Empty> alias { Empty {} };
|
||||
Variant<NonnullRefPtr<Identifier>, NonnullRefPtr<Expression>, Empty> name {};
|
||||
Variant<NonnullRefPtr<Identifier>, NonnullRefPtr<BindingPattern>, Empty> alias {};
|
||||
RefPtr<Expression> initializer {};
|
||||
bool is_rest { false };
|
||||
|
||||
|
|
|
@ -2180,7 +2180,7 @@ NonnullRefPtr<VariableDeclaration> Parser::parse_variable_declaration(bool for_l
|
|||
|
||||
NonnullRefPtrVector<VariableDeclarator> declarations;
|
||||
for (;;) {
|
||||
Variant<NonnullRefPtr<Identifier>, NonnullRefPtr<BindingPattern>, Empty> target { Empty() };
|
||||
Variant<NonnullRefPtr<Identifier>, NonnullRefPtr<BindingPattern>, Empty> target {};
|
||||
if (match_identifier()) {
|
||||
auto identifier_start = push_start();
|
||||
auto name = consume_identifier().value();
|
||||
|
|
|
@ -239,7 +239,7 @@ private:
|
|||
String m_message;
|
||||
StringView m_trivia;
|
||||
StringView m_original_value;
|
||||
Variant<Empty, StringView, FlyString> m_value { Empty {} };
|
||||
Variant<Empty, StringView, FlyString> m_value {};
|
||||
StringView m_filename;
|
||||
size_t m_line_number { 0 };
|
||||
size_t m_line_column { 0 };
|
||||
|
|
|
@ -1567,7 +1567,7 @@ bool ECMA262Parser::parse_atom_escape(ByteCode& stack, size_t& match_length_mini
|
|||
}
|
||||
|
||||
if (unicode) {
|
||||
PropertyEscape property { Empty {} };
|
||||
PropertyEscape property {};
|
||||
bool negated = false;
|
||||
|
||||
if (parse_unicode_property_escape(property, negated)) {
|
||||
|
@ -1847,7 +1847,7 @@ bool ECMA262Parser::parse_nonempty_class_ranges(Vector<CompareTypeAndValuePair>&
|
|||
if (try_skip("-"))
|
||||
return { CharClassRangeElement { .code_point = '-', .is_character_class = false } };
|
||||
|
||||
PropertyEscape property { Empty {} };
|
||||
PropertyEscape property {};
|
||||
bool negated = false;
|
||||
if (parse_unicode_property_escape(property, negated)) {
|
||||
return property.visit(
|
||||
|
|
|
@ -521,8 +521,8 @@ private:
|
|||
Empty,
|
||||
Crypto::Cipher::AESCipher::CBCMode,
|
||||
Crypto::Cipher::AESCipher::GCMMode>;
|
||||
CipherVariant m_cipher_local { Empty {} };
|
||||
CipherVariant m_cipher_remote { Empty {} };
|
||||
CipherVariant m_cipher_local {};
|
||||
CipherVariant m_cipher_remote {};
|
||||
|
||||
bool m_has_scheduled_write_flush { false };
|
||||
bool m_has_scheduled_app_data_flush { false };
|
||||
|
|
|
@ -381,7 +381,7 @@ Optional<InstantiationError> AbstractMachine::allocate_all_initial_phase(Module
|
|||
});
|
||||
module.for_each_section_of_type<ExportSection>([&](ExportSection const& section) {
|
||||
for (auto& entry : section.entries()) {
|
||||
Variant<FunctionAddress, TableAddress, MemoryAddress, GlobalAddress, Empty> address { Empty {} };
|
||||
Variant<FunctionAddress, TableAddress, MemoryAddress, GlobalAddress, Empty> address {};
|
||||
entry.description().visit(
|
||||
[&](FunctionIndex const& index) {
|
||||
if (module_instance.functions().size() > index.value())
|
||||
|
|
|
@ -352,7 +352,7 @@ private:
|
|||
// Type::Comment (comment data), Type::StartTag and Type::EndTag (tag name)
|
||||
String m_string_data;
|
||||
|
||||
Variant<Empty, u32, OwnPtr<DoctypeData>, OwnPtr<Vector<Attribute>>> m_data { Empty {} };
|
||||
Variant<Empty, u32, OwnPtr<DoctypeData>, OwnPtr<Vector<Attribute>>> m_data {};
|
||||
|
||||
Position m_start_position;
|
||||
Position m_end_position;
|
||||
|
|
Loading…
Add table
Reference in a new issue