mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:37:35 +00:00
Libraries: Use AK::Variant default initialization where appropriate
This commit is contained in:
parent
98a0f9c0bd
commit
32e98d0924
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>;
|
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> {
|
class Manager final : public HashFunction<0, MultiHashDigestVariant> {
|
||||||
|
@ -198,7 +198,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using AlgorithmVariant = Variant<Empty, MD5, SHA1, SHA256, SHA384, SHA512>;
|
using AlgorithmVariant = Variant<Empty, MD5, SHA1, SHA256, SHA384, SHA512>;
|
||||||
AlgorithmVariant m_algorithm { Empty {} };
|
AlgorithmVariant m_algorithm {};
|
||||||
HashKind m_kind { HashKind::None };
|
HashKind m_kind { HashKind::None };
|
||||||
ByteBuffer m_pre_init_buffer;
|
ByteBuffer m_pre_init_buffer;
|
||||||
};
|
};
|
||||||
|
|
|
@ -317,8 +317,8 @@ struct BindingPattern : RefCounted<BindingPattern> {
|
||||||
// This covers both BindingProperty and BindingElement, hence the more generic name
|
// This covers both BindingProperty and BindingElement, hence the more generic name
|
||||||
struct BindingEntry {
|
struct BindingEntry {
|
||||||
// If this entry represents a BindingElement, then name will be Empty
|
// If this entry represents a BindingElement, then name will be Empty
|
||||||
Variant<NonnullRefPtr<Identifier>, NonnullRefPtr<Expression>, Empty> name { Empty {} };
|
Variant<NonnullRefPtr<Identifier>, NonnullRefPtr<Expression>, Empty> name {};
|
||||||
Variant<NonnullRefPtr<Identifier>, NonnullRefPtr<BindingPattern>, Empty> alias { Empty {} };
|
Variant<NonnullRefPtr<Identifier>, NonnullRefPtr<BindingPattern>, Empty> alias {};
|
||||||
RefPtr<Expression> initializer {};
|
RefPtr<Expression> initializer {};
|
||||||
bool is_rest { false };
|
bool is_rest { false };
|
||||||
|
|
||||||
|
|
|
@ -2180,7 +2180,7 @@ NonnullRefPtr<VariableDeclaration> Parser::parse_variable_declaration(bool for_l
|
||||||
|
|
||||||
NonnullRefPtrVector<VariableDeclarator> declarations;
|
NonnullRefPtrVector<VariableDeclarator> declarations;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
Variant<NonnullRefPtr<Identifier>, NonnullRefPtr<BindingPattern>, Empty> target { Empty() };
|
Variant<NonnullRefPtr<Identifier>, NonnullRefPtr<BindingPattern>, Empty> target {};
|
||||||
if (match_identifier()) {
|
if (match_identifier()) {
|
||||||
auto identifier_start = push_start();
|
auto identifier_start = push_start();
|
||||||
auto name = consume_identifier().value();
|
auto name = consume_identifier().value();
|
||||||
|
|
|
@ -239,7 +239,7 @@ private:
|
||||||
String m_message;
|
String m_message;
|
||||||
StringView m_trivia;
|
StringView m_trivia;
|
||||||
StringView m_original_value;
|
StringView m_original_value;
|
||||||
Variant<Empty, StringView, FlyString> m_value { Empty {} };
|
Variant<Empty, StringView, FlyString> m_value {};
|
||||||
StringView m_filename;
|
StringView m_filename;
|
||||||
size_t m_line_number { 0 };
|
size_t m_line_number { 0 };
|
||||||
size_t m_line_column { 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) {
|
if (unicode) {
|
||||||
PropertyEscape property { Empty {} };
|
PropertyEscape property {};
|
||||||
bool negated = false;
|
bool negated = false;
|
||||||
|
|
||||||
if (parse_unicode_property_escape(property, negated)) {
|
if (parse_unicode_property_escape(property, negated)) {
|
||||||
|
@ -1847,7 +1847,7 @@ bool ECMA262Parser::parse_nonempty_class_ranges(Vector<CompareTypeAndValuePair>&
|
||||||
if (try_skip("-"))
|
if (try_skip("-"))
|
||||||
return { CharClassRangeElement { .code_point = '-', .is_character_class = false } };
|
return { CharClassRangeElement { .code_point = '-', .is_character_class = false } };
|
||||||
|
|
||||||
PropertyEscape property { Empty {} };
|
PropertyEscape property {};
|
||||||
bool negated = false;
|
bool negated = false;
|
||||||
if (parse_unicode_property_escape(property, negated)) {
|
if (parse_unicode_property_escape(property, negated)) {
|
||||||
return property.visit(
|
return property.visit(
|
||||||
|
|
|
@ -521,8 +521,8 @@ private:
|
||||||
Empty,
|
Empty,
|
||||||
Crypto::Cipher::AESCipher::CBCMode,
|
Crypto::Cipher::AESCipher::CBCMode,
|
||||||
Crypto::Cipher::AESCipher::GCMMode>;
|
Crypto::Cipher::AESCipher::GCMMode>;
|
||||||
CipherVariant m_cipher_local { Empty {} };
|
CipherVariant m_cipher_local {};
|
||||||
CipherVariant m_cipher_remote { Empty {} };
|
CipherVariant m_cipher_remote {};
|
||||||
|
|
||||||
bool m_has_scheduled_write_flush { false };
|
bool m_has_scheduled_write_flush { false };
|
||||||
bool m_has_scheduled_app_data_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) {
|
module.for_each_section_of_type<ExportSection>([&](ExportSection const& section) {
|
||||||
for (auto& entry : section.entries()) {
|
for (auto& entry : section.entries()) {
|
||||||
Variant<FunctionAddress, TableAddress, MemoryAddress, GlobalAddress, Empty> address { Empty {} };
|
Variant<FunctionAddress, TableAddress, MemoryAddress, GlobalAddress, Empty> address {};
|
||||||
entry.description().visit(
|
entry.description().visit(
|
||||||
[&](FunctionIndex const& index) {
|
[&](FunctionIndex const& index) {
|
||||||
if (module_instance.functions().size() > index.value())
|
if (module_instance.functions().size() > index.value())
|
||||||
|
|
|
@ -352,7 +352,7 @@ private:
|
||||||
// Type::Comment (comment data), Type::StartTag and Type::EndTag (tag name)
|
// Type::Comment (comment data), Type::StartTag and Type::EndTag (tag name)
|
||||||
String m_string_data;
|
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_start_position;
|
||||||
Position m_end_position;
|
Position m_end_position;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue